pub trait Value:
Any
+ Clone
+ Debug
+ Eq
+ Send
+ Sync { }Expand description
Value.
Note that this trait must be explicitly implemented for types that should be handled by the scheduler, as it’s not implemented for built-in types by default, which helps to make subscriptions between components intentionally explicit instead of implicit.
If this trait were implemented for built-in types by default, it would be
too easy to accidentally subscribe to a type without realizing it, which
could manifest in unexpected behavior that makes it harder to debug issues.
So, Action::Inputs and Action::Output must explicitly implement
this trait, requiring simple types to be wrapped in newtypes, which ensures
that all interactions between modules are intentional and well-defined.
Implementors must implement Any, Clone, Debug, Eq, as well
as Send and Sync, so all values can be shared across threads and
printed for debugging. Clone is required for distributing values to the
subscribers of an Action, rendering Value as not dyn-compatible.
However, this is not a problem and actually a good thing, as values should
not be downcast, rather the stores and receivers that manage them.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.