johanhelsing / matchbox

Painless peer-to-peer WebRTC networking for rust wasm (and native!)
Apache License 2.0
869 stars 72 forks source link

Reflect for PeerId #316

Closed simbleau closed 10 months ago

simbleau commented 1 year ago

Let's get Reflect derived for PeerId.

johanhelsing commented 11 months ago

This would require a bevy_reflect feature and optional dependency for matchbox_protocol?

simbleau commented 10 months ago

This would require a bevy_reflect feature and optional dependency for matchbox_protocol?

Not sure, the docs for Reflect vs. FromReflect, etc. are not clear.

johanhelsing commented 10 months ago

Foreign traits can't be implemented on foreign types. So has to go in bevy_reflect or matchbox_protocol.

What's your use case?

simbleau commented 10 months ago

I'm using https://github.com/jakobhellermann/bevy-inspector-egui

It allows you to change the values of entities at runtime for debugging. I can't seem to implement Reflect for any type that encompasses a PeerId because you cannot derive Reflect unless all the fields also implement Reflect.

johanhelsing commented 10 months ago

Is it perhaps possible to implement manually? Or #[reflect(ignore)] those fields?

Having bevy as an optional dependency in a protocol-level crate seems a bit backwards to me. Especially since bevy has breaking releases so often.

simbleau commented 10 months ago

Is it perhaps possible to implement manually? Or #[reflect(ignore)] those fields?

Having bevy as an optional dependency in a protocol-level crate seems a bit backwards to me. Especially since bevy has breaking releases so often.

+1

johanhelsing commented 10 months ago

Seems like maybe it will be possible to define it in bevy_matchbox in bevy 0.13: https://github.com/bevyengine/bevy/pull/6042

Testare commented 9 months ago

Seems like maybe it will be possible to define it in bevy_matchbox in bevy 0.13: bevyengine/bevy#6042

It seems so, but that PR has been bumped through several versions of bevy. If you want this functionality, definitely give that PR a review! It's not an easy one, but it would be really helpful =]