jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.19k stars 173 forks source link

Implement `Inspectable` for `Cow<a, T>` #96

Closed TehPers closed 1 year ago

TehPers commented 1 year ago

This would allow us to inspect types like Cow<'static, str>. By converting the Cow to its owned variant using .to_mut(), we're able to implement this for all T where T: ToOwned and T::Owned: Inspectable, allowing users to modify the values behind Cow<'static, str> for instance.

This should be pretty trivial to implement. I can open a PR for it, just making sure that there is interest.

jakobhellermann commented 1 year ago

The new release 0.16 is now centered around Reflect instead of Inspectable, so since Cow<'static> implements Reflect this should work now

zlepper commented 1 year ago

To anyone who ends here from searching.

You might encounter an issue like this:

thread 'main' panicked at 'alloc::borrow::Cow not registered', C:\Users\xxx.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy-inspector-egui-0.18.3\src\inspector_egui_impls\mod.rs:121:28

This happens because the EditorPlugin is added to the app before the DefaultPlugins. Ensure the DefaultPlugins are added before the EditorPlugin.