Skip to main content

Value

Enum Value 

Source
pub enum Value<T> {
    Static(T),
    Dynamic(Rc<dyn Fn() -> T>),
}
Expand description

A property that is either fixed or computed from signals.

Value::Static is written once, when the element is built. Value::Dynamic becomes a binding: the closure is read when the node mounts and again whenever a signal it reads changes.

A value converts into this type, so a builder method can take either one.

Variants§

§

Static(T)

A value that never changes.

§

Dynamic(Rc<dyn Fn() -> T>)

A closure that reads the value from signals.

Trait Implementations§

Source§

impl<T: Clone> Clone for Value<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<&str> for Value<String>

Source§

fn from(text: &str) -> Value<String>

Converts to this type from the input type.
Source§

impl From<Align> for Value<Align>

Source§

fn from(value: Align) -> Value<Align>

Converts to this type from the input type.
Source§

impl From<Color> for Value<ColorValue>

Source§

fn from(color: Color) -> Value<ColorValue>

Converts to this type from the input type.
Source§

impl From<ColorToken> for Value<ColorValue>

Source§

fn from(token: ColorToken) -> Value<ColorValue>

Converts to this type from the input type.
Source§

impl From<ColorValue> for Value<ColorValue>

Source§

fn from(value: ColorValue) -> Value<ColorValue>

Converts to this type from the input type.
Source§

impl From<Cursor> for Value<Option<Cursor>>

Source§

fn from(cursor: Cursor) -> Value<Option<Cursor>>

Converts to this type from the input type.
Source§

impl From<Direction> for Value<Direction>

Source§

fn from(value: Direction) -> Value<Direction>

Converts to this type from the input type.
Source§

impl From<Edges<Length>> for Value<Edges<Length>>

Source§

fn from(value: Edges<Length>) -> Value<Edges<Length>>

Converts to this type from the input type.
Source§

impl<F: Fn() -> T + 'static, T: 'static> From<F> for Value<T>

Source§

fn from(get: F) -> Value<T>

Converts to this type from the input type.
Source§

impl From<Justify> for Value<Justify>

Source§

fn from(value: Justify) -> Value<Justify>

Converts to this type from the input type.
Source§

impl From<Length> for Value<Length>

Source§

fn from(value: Length) -> Value<Length>

Converts to this type from the input type.
Source§

impl From<Option<Cursor>> for Value<Option<Cursor>>

Source§

fn from(cursor: Option<Cursor>) -> Value<Option<Cursor>>

Converts to this type from the input type.
Source§

impl From<Option<Image>> for Value<Option<Image>>

Source§

fn from(value: Option<Image>) -> Value<Option<Image>>

Converts to this type from the input type.
Source§

impl From<Option<u32>> for Value<Option<u32>>

Source§

fn from(value: Option<u32>) -> Value<Option<u32>>

Converts to this type from the input type.
Source§

impl From<Overflow> for Value<Overflow>

Source§

fn from(value: Overflow) -> Value<Overflow>

Converts to this type from the input type.
Source§

impl From<Point> for Value<Point>

Source§

fn from(value: Point) -> Value<Point>

Converts to this type from the input type.
Source§

impl From<RadiusToken> for Value<RadiusValue>

Source§

fn from(token: RadiusToken) -> Value<RadiusValue>

Converts to this type from the input type.
Source§

impl From<RadiusValue> for Value<RadiusValue>

Source§

fn from(value: RadiusValue) -> Value<RadiusValue>

Converts to this type from the input type.
Source§

impl From<Size> for Value<Size>

Source§

fn from(value: Size) -> Value<Size>

Converts to this type from the input type.
Source§

impl From<String> for Value<String>

Source§

fn from(text: String) -> Value<String>

Converts to this type from the input type.
Source§

impl From<bool> for Value<bool>

Source§

fn from(value: bool) -> Value<bool>

Converts to this type from the input type.
Source§

impl From<f32> for Value<f32>

Source§

fn from(value: f32) -> Value<f32>

Converts to this type from the input type.
Source§

impl From<f32> for Value<RadiusValue>

Source§

fn from(radius: f32) -> Value<RadiusValue>

Converts to this type from the input type.
Source§

impl From<u32> for Value<u32>

Source§

fn from(value: u32) -> Value<u32>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Value<T>

§

impl<T> !Send for Value<T>

§

impl<T> !Sync for Value<T>

§

impl<T> !UnwindSafe for Value<T>

§

impl<T> Forget for Value<T>

§

impl<T> Freeze for Value<T>
where T: Freeze, Rc<dyn Fn() -> T>: Freeze,

§

impl<T> Move for Value<T>

§

impl<T> Unpin for Value<T>
where T: Unpin, Rc<dyn Fn() -> T>: Unpin,

§

impl<T> UnsafeUnpin for Value<T>
where T: UnsafeUnpin, Rc<dyn Fn() -> T>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.