-
-
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
[Merged by Bors] - Obviate the need for RunSystem
, and remove it
#3817
Conversation
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.
Very nice. It's good to simplify this, and the code itself makes sense. Minor docs nit, then this looks good to me.
/// For example, using this would allow a type to be generic over | ||
/// whether a resource is accessed mutably or not, with | ||
/// impls being bounded on [`P: Deref<Target=MyType>`](Deref), and | ||
/// [`P: DerefMut<Target=MyType>`](DerefMut) depending on whether the | ||
/// method requires mutable access or not. |
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 plan on trying to use this trick for Assets
(to remove the fact that the events are seperate in an ergonomic way)
That will be a seperate PR.
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've done some more thinking about this, and I realise that none of the reading only Assets
methods access the events.
I don't actually think that PR would need this struct/this trick. Still, this is much nicer than RunSystem
bors try |
tryMerge conflict. |
bors retry |
/// This type is a [`SystemParam`] adapter which always has | ||
/// `Self::Fetch::Item == Self` (ignoring lifetimes for brevity), | ||
/// no matter the argument [`SystemParam`] (`P`) (other than | ||
/// that `P` must be `'static`) |
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.
This restriction is unfortunate, but pretty fundamental as far as I can tell.
This is because we need be able to refer to P
in SystemParamState
, which reasonably needs to be 'static
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.
Looks good other than this one nit :P
37756b1
to
0acc369
Compare
Add missing `DerefMut` impl and `inner` fn
Remove `RunSystem`
Also add a proper read-only delegation
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 like these changes. It keeps the hackery scoped and allows us to use the "same" system paradigm everywhere. It would be nice if we didn't need the "wrapper" StaticSystemParamState or StaticSystemParam types, but I understand why they're there.
(I just removed the old Config api usage, which would have failed during bors validation) |
bors r+ |
# Objective - Fixes #3300 - `RunSystem` is messy ## Solution - Adds the trick theorised in #3300 (comment) P.S. I also want this for an experimental refactoring of `Assets`, to remove the duplication of `Events<AssetEvent<T>>` Co-authored-by: Carter Anderson <mcanders1@gmail.com>
RunSystem
, and remove itRunSystem
, and remove it
# Objective - Fixes bevyengine#3300 - `RunSystem` is messy ## Solution - Adds the trick theorised in bevyengine#3300 (comment) P.S. I also want this for an experimental refactoring of `Assets`, to remove the duplication of `Events<AssetEvent<T>>` Co-authored-by: Carter Anderson <mcanders1@gmail.com>
# Objective - Fixes bevyengine#3300 - `RunSystem` is messy ## Solution - Adds the trick theorised in bevyengine#3300 (comment) P.S. I also want this for an experimental refactoring of `Assets`, to remove the duplication of `Events<AssetEvent<T>>` Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Objective
RunSystem
is messySolution
P.S. I also want this for an experimental refactoring of
Assets
, to remove the duplication ofEvents<AssetEvent<T>>