Skip to content

Commit

Permalink
Use PartialReflect
Browse files Browse the repository at this point in the history
Looks like it should be `PartialReflect` after all:
bevyengine/bevy#7207
  • Loading branch information
Shatur committed Nov 6, 2024
1 parent 64b98c6 commit 9d175e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/core/event_registry/client_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub trait ClientEventAppExt {
event: &ReflectEvent,
cursor: &mut Cursor<Vec<u8>>,
) -> bincode::Result<()> {
let serializer = ReflectSerializer::new(&*event.0.as_partial_reflect(), ctx.registry);
let serializer = ReflectSerializer::new(&*event.0, ctx.registry);
DefaultOptions::new().serialize_into(cursor, &serializer)
}
Expand All @@ -106,11 +106,11 @@ pub trait ClientEventAppExt {
) -> bincode::Result<ReflectEvent> {
let mut deserializer = bincode::Deserializer::with_reader(cursor, DefaultOptions::new());
let reflect = ReflectDeserializer::new(ctx.registry).deserialize(&mut deserializer)?;
Ok(ReflectEvent(reflect.try_into_reflect().unwrap()))
Ok(ReflectEvent(reflect))
}
#[derive(Event)]
struct ReflectEvent(Box<dyn Reflect>);
struct ReflectEvent(Box<dyn PartialReflect>);
```
*/
fn add_client_event_with<E: Event>(
Expand Down
6 changes: 3 additions & 3 deletions src/core/event_registry/server_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub trait ServerEventAppExt {
event: &ReflectEvent,
cursor: &mut Cursor<Vec<u8>>,
) -> bincode::Result<()> {
let serializer = ReflectSerializer::new(&*event.0.as_partial_reflect(), ctx.registry);
let serializer = ReflectSerializer::new(&*event.0, ctx.registry);
DefaultOptions::new().serialize_into(cursor, &serializer)
}
Expand All @@ -113,11 +113,11 @@ pub trait ServerEventAppExt {
) -> bincode::Result<ReflectEvent> {
let mut deserializer = bincode::Deserializer::with_reader(cursor, DefaultOptions::new());
let reflect = ReflectDeserializer ::new(ctx.registry).deserialize(&mut deserializer)?;
Ok(ReflectEvent(reflect.try_into_reflect().unwrap()))
Ok(ReflectEvent(reflect))
}
#[derive(Event)]
struct ReflectEvent(Box<dyn Reflect>);
struct ReflectEvent(Box<dyn PartialReflect>);
```
*/
fn add_server_event_with<E: Event>(
Expand Down

0 comments on commit 9d175e4

Please sign in to comment.