-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FunctionSystem
to use a single Option
#16514
Conversation
pub(crate) system_meta: SystemMeta, | ||
world_id: Option<WorldId>, | ||
state: Option<FunctionSystemState<Marker, F>>, | ||
system_meta: SystemMeta, | ||
archetype_generation: ArchetypeGeneration, | ||
// NOTE: PhantomData<fn()-> T> gives this safe Send/Sync impls | ||
marker: PhantomData<fn() -> Marker>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this PhantomData
still needed with Marker
now appearing in FunctionSystemState<Marker, F>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It no longer appears in FunctionSystemState
, so I'm assuming it still needs to exist.
Option
FunctionSystem
to use a single Option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the potential implications of this change, but I've reviewed the diff and it makes sense to me. Option<FunctionSystemState>
makes the uninitialized vs initialized semantics for function systems more obvious.
# Objective Combine the `Option<_>` state in `FunctionSystem` into a single `Option` to provide clarity and save space. ## Solution Simplifies `FunctionSystem`'s layout by using a single `Option<FunctionSystemState>` for state that must be initialized before running, and saves a byte by removing the need to store an enum tag. Additionally, calling `System::run` on an uninitialized `System` will now give a more descriptive message prior to verifying the `WorldId`. ## Testing Ran CI checks locally.
# Objective Combine the `Option<_>` state in `FunctionSystem` into a single `Option` to provide clarity and save space. ## Solution Simplifies `FunctionSystem`'s layout by using a single `Option<FunctionSystemState>` for state that must be initialized before running, and saves a byte by removing the need to store an enum tag. Additionally, calling `System::run` on an uninitialized `System` will now give a more descriptive message prior to verifying the `WorldId`. ## Testing Ran CI checks locally.
Objective
Combine the
Option<_>
state inFunctionSystem
into a singleOption
to provide clarity and save space.Solution
Simplifies
FunctionSystem
's layout by using a singleOption<FunctionSystemState>
for state that must be initialized before running, and saves a byte by removing the need to store an enum tag. Additionally, callingSystem::run
on an uninitializedSystem
will now give a more descriptive message prior to verifying theWorldId
.Testing
Ran CI checks locally.