pub trait IntoVar<T: VarValue> {
// Required method
fn into_var(self) -> Var<T>;
}Expand description
A value-to-var conversion that consumes the value.
Every Var<T> implements this to convert to itself, every VarValue implements this to
convert to a const_var.
This trait is used by most properties, it allows then to accept literal values, variables and context variables
all with a single signature. Together with Var<T> this gives properties great flexibility of usage. Widget
when blocks also use IntoVar<T> to support changing the property value depending on the widget state.
Value types can also manually implement this to support a shorthand literal syntax for when they are used in properties,
this converts the shorthand value like a tuple into the actual value type and wraps it into a variable, usually const_var.
Value types can implement the trait multiple times to support different shorthand syntaxes.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".