VarValue

Trait VarValue 

Source
pub trait VarValue:
    AnyVarValue
    + Clone
    + PartialEq { }
Expand description

Represents a type that can be a Var<T> value.

§Trait Alias

This trait is used like a type alias for traits and is already implemented for all types it can apply to.

§Implementing

Types need to be Debug + Clone + PartialEq + Send + Sync + Any to auto-implement this trait, if you want to place an external type in a variable and it does not implement all the traits you may need to declare a newtype wrapper.

If the external type is at least Debug + Send + Sync + Any you can use the ArcEq<T> wrapper to quickly implement Clone + PartialEq, this is particularly useful for error types in ResponseVar<Result<_, E>>.

If you want to use another variable as value use the VarEq<T> wrapper to use Var::var_eq as PartialEq. Vars are not allowed to be values directly as that causes type inference issues.

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.

Implementors§