IntoVar

Trait IntoVar 

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

Source

fn into_var(self) -> Var<T>

Implementations on Foreign Types§

Source§

impl IntoVar<Cow<'static, str>> for Txt

Source§

fn into_var(self) -> Var<Cow<'static, str>>

Source§

impl IntoVar<Option<Orientation2D>> for Orientation2D

Source§

impl IntoVar<Option<bool>> for bool

Source§

impl IntoVar<Option<char>> for char

Source§

impl IntoVar<Option<f32>> for f32

Source§

impl IntoVar<Option<f64>> for f64

Source§

impl IntoVar<Option<i8>> for i8

Source§

impl IntoVar<Option<i16>> for i16

Source§

impl IntoVar<Option<i32>> for i32

Source§

impl IntoVar<Option<i64>> for i64

Source§

impl IntoVar<Option<i128>> for i128

Source§

impl IntoVar<Option<isize>> for isize

Source§

impl IntoVar<Option<u8>> for u8

Source§

impl IntoVar<Option<u16>> for u16

Source§

impl IntoVar<Option<u32>> for u32

Source§

impl IntoVar<Option<u64>> for u64

Source§

impl IntoVar<Option<u128>> for u128

Source§

impl IntoVar<Option<usize>> for usize

Source§

impl IntoVar<Deadline> for DInstant

Source§

impl IntoVar<Deadline> for Duration

Source§

impl IntoVar<Txt> for &'static str

Source§

fn into_var(self) -> Var<Txt>

Source§

impl IntoVar<Txt> for Cow<'static, str>

Source§

fn into_var(self) -> Var<Txt>

Source§

impl IntoVar<Txt> for char

Source§

fn into_var(self) -> Var<Txt>

Source§

impl IntoVar<Txt> for String

Source§

fn into_var(self) -> Var<Txt>

Source§

impl IntoVar<AngleDegree> for AngleGradian

Source§

impl IntoVar<AngleDegree> for AngleRadian

Source§

impl IntoVar<AngleDegree> for AngleTurn

Source§

impl IntoVar<AngleGradian> for AngleDegree

Source§

impl IntoVar<AngleGradian> for AngleRadian

Source§

impl IntoVar<AngleGradian> for AngleTurn

Source§

impl IntoVar<AngleRadian> for AngleDegree

Source§

impl IntoVar<AngleRadian> for AngleGradian

Source§

impl IntoVar<AngleRadian> for AngleTurn

Source§

impl IntoVar<AngleTurn> for AngleDegree

Source§

impl IntoVar<AngleTurn> for AngleGradian

Source§

impl IntoVar<AngleTurn> for AngleRadian

Source§

impl IntoVar<ByteLength> for usize

Source§

impl IntoVar<Factor> for bool

Source§

impl IntoVar<Factor> for f32

Source§

impl IntoVar<Factor> for FactorPercent

Source§

impl IntoVar<FactorPercent> for Factor

Source§

impl IntoVar<EasingTime> for Factor

Source§

impl IntoVar<EasingTime> for FactorPercent

Source§

impl IntoVar<String> for Txt

Source§

impl IntoVar<PathBuf> for Txt

Implementors§