[Merged by Bors] - Obviate the need for RunSystem, and remove it#3817
[Merged by Bors] - Obviate the need for RunSystem, and remove it#3817DJMcNab wants to merge 6 commits intobevyengine:mainfrom
RunSystem, and remove it#3817Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
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.
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.
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.
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
TheRawMeatball
left a comment
There was a problem hiding this comment.
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
cart
left a comment
There was a problem hiding this comment.
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
RunSystemis messySolution
P.S. I also want this for an experimental refactoring of
Assets, to remove the duplication ofEvents<AssetEvent<T>>