-
-
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
Add FromReflect::from_reflect_owned
#6419
Comments
FromReflect::from_reflect_owned
Great writeup! This is a bit more advanced than most good-first-issues, but the detailed plan and existing methods to learn from should help a ton (assuming you're not planning to tackle this yourself). |
I think I could try to tackle if people like this suggestion. |
I like it a lot! The basic motivation is solid and the approach seems good. |
Having an issue with implementing bevy/crates/bevy_reflect/src/struct_trait.rs Line 261 in aa8c745
Non-owned version uses acess by index or field name: bevy/crates/bevy_reflect/src/struct_trait.rs Lines 262 to 263 in aa8c745
But in owned version I need to move out values somehow. Can't figure out how to do it, so help is appreciated (just take a look at todo!() in #6421).
|
No longer interested in it, closing. |
What problem does this solve or what need does it fill?
Currently to apply a reflect value that was deserialized from bytes it copies all its fields. It would be nice to have an ability avoid this extra copy. For example, when doing networking and sending world state in a form of reflect - it could be a lot of extra copies.
What solution would you like?
Add
from_reflect_owned
toFromReflect
trait.Implementation strategy.
ReflectOwned
enum with boxes likeReflectRef
to get owned version.reflect_owned
method toReflect
likereflect_ref
that returnsReflectOwned
introduced above.drain
method from [Merged by Bors] - bevy_reflect: Get owned fields #5728 for arrays / maps and add owned versions of things likeStruct::field
.from_reflect_owned
similar to non-owned version:bevy/crates/bevy_reflect/bevy_reflect_derive/src/from_reflect.rs
Lines 132 to 137 in aa8c745
The text was updated successfully, but these errors were encountered: