Skip to main content

Value

Trait Value 

Source
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.

Implementations on Foreign Types§

Source§

impl Value for ()

Source§

impl<T1> Value for (T1,)
where T1: Value,

Source§

impl<T1, T2> Value for (T1, T2)
where T1: Value, T2: Value,

Source§

impl<T1, T2, T3> Value for (T1, T2, T3)
where T1: Value, T2: Value, T3: Value,

Source§

impl<T1, T2, T3, T4> Value for (T1, T2, T3, T4)
where T1: Value, T2: Value, T3: Value, T4: Value,

Source§

impl<T1, T2, T3, T4, T5> Value for (T1, T2, T3, T4, T5)
where T1: Value, T2: Value, T3: Value, T4: Value, T5: Value,

Source§

impl<T1, T2, T3, T4, T5, T6> Value for (T1, T2, T3, T4, T5, T6)
where T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value,

Source§

impl<T1, T2, T3, T4, T5, T6, T7> Value for (T1, T2, T3, T4, T5, T6, T7)
where T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value,

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8> Value for (T1, T2, T3, T4, T5, T6, T7, T8)
where T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value,

Source§

impl<T> Value for Option<T>
where T: Value,

Source§

impl<T> Value for Vec<T>
where T: Value,

Implementors§

Source§

impl<I> Value for Key<I>
where I: Value,

Source§

impl<I> Value for Barrier<I>
where I: Id,