A common pattern I used in OOP is having interfaces that components can then implement for their own custom behavior. I'd like to use this in ECS for serialization and other reading purposes.
But there are a few issues preventing me from implementing this:
- Since rust doesn't have a runtime type system, it's not possible to check if a struct implements a trait at runtime and execute a method on that trait.
- I'm not sure if I can even access all components at runtime, since the it seems bevy only provide
ComponentInfoinformation about the components attached to an entity.
Would something like this be possible in Bevy? I might also be thinking in the wrong direction in terms of ECS.