You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to serialize inputs to a config file and deserialize it back. But there are a 2 problems:
Boxes can't be serialized / deserialized without additional effort.
All insertion methods on InputMap accept concrete type, not a fat pointer.
What solution would you like?
Not exactly sure how to solve this...
For 1 we can use something like https://github.com/dtolnay/erased-serde, but it require a separate crate for such a common use case is not very nice. It's also possible to use Bevy's reflection. But it requires manual ser/de implementation for user which is hard to write.
For 2 we can accept Into<Box<dyn Trait>> since all methods internally do Box::new.
[Optional] What alternatives have you considered?
Maybe using traits wasn't the right call... Maybe we could have better enums? Like keep all insert, insert_axislike etc., but use enums instead of boxes.
What problem does this solve?
I would like to be able to serialize inputs to a config file and deserialize it back. But there are a 2 problems:
InputMap
accept concrete type, not a fat pointer.What solution would you like?
Not exactly sure how to solve this...
For 1 we can use something like https://github.com/dtolnay/erased-serde, but it require a separate crate for such a common use case is not very nice. It's also possible to use Bevy's reflection. But it requires manual ser/de implementation for user which is hard to write.
For 2 we can accept
Into<Box<dyn Trait>>
since all methods internally doBox::new
.[Optional] What alternatives have you considered?
Maybe using traits wasn't the right call... Maybe we could have better enums? Like keep all
insert
,insert_axislike
etc., but use enums instead of boxes.Related work
Caused by #534.
The text was updated successfully, but these errors were encountered: