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 From<ColorToken> for Value<ColorValue>
impl From<ColorToken> for Value<ColorValue>
Source§fn from(token: ColorToken) -> Value<ColorValue>
fn from(token: ColorToken) -> Value<ColorValue>
Converts to this type from the input type.
Source§impl From<ColorValue> for Value<ColorValue>
impl From<ColorValue> for Value<ColorValue>
Source§fn from(value: ColorValue) -> Value<ColorValue>
fn from(value: ColorValue) -> Value<ColorValue>
Converts to this type from the input type.
Source§impl From<RadiusToken> for Value<RadiusValue>
impl From<RadiusToken> for Value<RadiusValue>
Source§fn from(token: RadiusToken) -> Value<RadiusValue>
fn from(token: RadiusToken) -> Value<RadiusValue>
Converts to this type from the input type.
Source§impl From<RadiusValue> for Value<RadiusValue>
impl From<RadiusValue> for Value<RadiusValue>
Source§fn from(value: RadiusValue) -> Value<RadiusValue>
fn from(value: RadiusValue) -> Value<RadiusValue>
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>
impl<T> Move for Value<T>
impl<T> Unpin for Value<T>
impl<T> UnsafeUnpin for Value<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more