#[non_exhaustive]#[repr(u8)]pub enum Value {
Void = 0,
Number(f64),
String(SharedString),
Bool(bool),
Image(Image),
Model(ModelRc<Value>),
Struct(Struct),
Brush(Brush),
}
Expand description
This is a dynamically typed value used in the Slint interpreter.
It can hold a value of different types, and you should use the
From
or TryFrom
traits to access the value.
use core::convert::TryInto;
// create a value containing an integer
let v = Value::from(100u32);
assert_eq!(v.try_into(), Ok(100u32));
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Void = 0
There is nothing in this value. That’s the default. For example, a function that does not return a result would return a Value::Void
Number(f64)
An int
or a float
(this is also used for unit based type such as length
or angle
)
String(SharedString)
Correspond to the string
type in .slint
Bool(bool)
Correspond to the bool
type in .slint
Image(Image)
Correspond to the image
type in .slint
Model(ModelRc<Value>)
A model (that includes array in .slint)
Struct(Struct)
An object
Brush(Brush)
Correspond to brush
or color
type in .slint. For color, this is then a Brush::SolidColor
Implementations§
Trait Implementations§
Source§impl From<AccessibleRole> for Value
impl From<AccessibleRole> for Value
Source§fn from(v: AccessibleRole) -> Self
fn from(v: AccessibleRole) -> Self
Converts to this type from the input type.
Source§impl From<AnimationDirection> for Value
impl From<AnimationDirection> for Value
Source§fn from(v: AnimationDirection) -> Self
fn from(v: AnimationDirection) -> Self
Converts to this type from the input type.
Source§impl From<ColorScheme> for Value
impl From<ColorScheme> for Value
Source§fn from(v: ColorScheme) -> Self
fn from(v: ColorScheme) -> Self
Converts to this type from the input type.
Source§impl From<ComponentFactory> for Value
impl From<ComponentFactory> for Value
Source§fn from(v: ComponentFactory) -> Self
fn from(v: ComponentFactory) -> Self
Converts to this type from the input type.
Source§impl From<DialogButtonRole> for Value
impl From<DialogButtonRole> for Value
Source§fn from(v: DialogButtonRole) -> Self
fn from(v: DialogButtonRole) -> Self
Converts to this type from the input type.
Source§impl From<EasingCurve> for Value
impl From<EasingCurve> for Value
Source§fn from(v: EasingCurve) -> Self
fn from(v: EasingCurve) -> Self
Converts to this type from the input type.
Source§impl From<EventResult> for Value
impl From<EventResult> for Value
Source§fn from(v: EventResult) -> Self
fn from(v: EventResult) -> Self
Converts to this type from the input type.
Source§impl From<FocusReason> for Value
impl From<FocusReason> for Value
Source§fn from(v: FocusReason) -> Self
fn from(v: FocusReason) -> Self
Converts to this type from the input type.
Source§impl From<FontMetrics> for Value
impl From<FontMetrics> for Value
Source§fn from(item: FontMetrics) -> Self
fn from(item: FontMetrics) -> Self
Converts to this type from the input type.
Source§impl From<ImageHorizontalAlignment> for Value
impl From<ImageHorizontalAlignment> for Value
Source§fn from(v: ImageHorizontalAlignment) -> Self
fn from(v: ImageHorizontalAlignment) -> Self
Converts to this type from the input type.
Source§impl From<ImageRendering> for Value
impl From<ImageRendering> for Value
Source§fn from(v: ImageRendering) -> Self
fn from(v: ImageRendering) -> Self
Converts to this type from the input type.
Source§impl From<ImageTiling> for Value
impl From<ImageTiling> for Value
Source§fn from(v: ImageTiling) -> Self
fn from(v: ImageTiling) -> Self
Converts to this type from the input type.
Source§impl From<ImageVerticalAlignment> for Value
impl From<ImageVerticalAlignment> for Value
Source§fn from(v: ImageVerticalAlignment) -> Self
fn from(v: ImageVerticalAlignment) -> Self
Converts to this type from the input type.
Source§impl From<KeyboardModifiers> for Value
impl From<KeyboardModifiers> for Value
Source§fn from(item: KeyboardModifiers) -> Self
fn from(item: KeyboardModifiers) -> Self
Converts to this type from the input type.
Source§impl From<LayoutAlignment> for Value
impl From<LayoutAlignment> for Value
Source§fn from(v: LayoutAlignment) -> Self
fn from(v: LayoutAlignment) -> Self
Converts to this type from the input type.
Source§impl From<LayoutInfo> for Value
impl From<LayoutInfo> for Value
Source§fn from(_: LayoutInfo) -> Self
fn from(_: LayoutInfo) -> Self
Converts to this type from the input type.
Source§impl From<Length<f32, LogicalPx>> for Value
impl From<Length<f32, LogicalPx>> for Value
Source§fn from(l: LogicalLength) -> Self
fn from(l: LogicalLength) -> Self
Converts to this type from the input type.
Source§impl From<LogicalPosition> for Value
impl From<LogicalPosition> for Value
Source§fn from(_: LogicalPosition) -> Self
fn from(_: LogicalPosition) -> Self
Converts to this type from the input type.
Source§impl From<MouseCursor> for Value
impl From<MouseCursor> for Value
Source§fn from(v: MouseCursor) -> Self
fn from(v: MouseCursor) -> Self
Converts to this type from the input type.
Source§impl From<OperatingSystemType> for Value
impl From<OperatingSystemType> for Value
Source§fn from(v: OperatingSystemType) -> Self
fn from(v: OperatingSystemType) -> Self
Converts to this type from the input type.
Source§impl From<Orientation> for Value
impl From<Orientation> for Value
Source§fn from(v: Orientation) -> Self
fn from(v: Orientation) -> Self
Converts to this type from the input type.
Source§impl From<PointerEvent> for Value
impl From<PointerEvent> for Value
Source§fn from(item: PointerEvent) -> Self
fn from(item: PointerEvent) -> Self
Converts to this type from the input type.
Source§impl From<PointerEventButton> for Value
impl From<PointerEventButton> for Value
Source§fn from(v: PointerEventButton) -> Self
fn from(v: PointerEventButton) -> Self
Converts to this type from the input type.
Source§impl From<PointerEventKind> for Value
impl From<PointerEventKind> for Value
Source§fn from(v: PointerEventKind) -> Self
fn from(v: PointerEventKind) -> Self
Converts to this type from the input type.
Source§impl From<PointerScrollEvent> for Value
impl From<PointerScrollEvent> for Value
Source§fn from(item: PointerScrollEvent) -> Self
fn from(item: PointerScrollEvent) -> Self
Converts to this type from the input type.
Source§impl From<PopupClosePolicy> for Value
impl From<PopupClosePolicy> for Value
Source§fn from(v: PopupClosePolicy) -> Self
fn from(v: PopupClosePolicy) -> Self
Converts to this type from the input type.
Source§impl From<ScrollBarPolicy> for Value
impl From<ScrollBarPolicy> for Value
Source§fn from(v: ScrollBarPolicy) -> Self
fn from(v: ScrollBarPolicy) -> Self
Converts to this type from the input type.
Source§fn from(v: SharedString) -> Self
fn from(v: SharedString) -> Self
Converts to this type from the input type.
Source§fn from(v: SharedVector<f32>) -> Self
fn from(v: SharedVector<f32>) -> Self
Converts to this type from the input type.
Source§impl From<StandardButtonKind> for Value
impl From<StandardButtonKind> for Value
Source§fn from(v: StandardButtonKind) -> Self
fn from(v: StandardButtonKind) -> Self
Converts to this type from the input type.
Source§impl From<StandardListViewItem> for Value
impl From<StandardListViewItem> for Value
Source§fn from(item: StandardListViewItem) -> Self
fn from(item: StandardListViewItem) -> Self
Converts to this type from the input type.
Source§impl From<TableColumn> for Value
impl From<TableColumn> for Value
Source§fn from(item: TableColumn) -> Self
fn from(item: TableColumn) -> Self
Converts to this type from the input type.
Source§impl From<TextHorizontalAlignment> for Value
impl From<TextHorizontalAlignment> for Value
Source§fn from(v: TextHorizontalAlignment) -> Self
fn from(v: TextHorizontalAlignment) -> Self
Converts to this type from the input type.
Source§impl From<TextOverflow> for Value
impl From<TextOverflow> for Value
Source§fn from(v: TextOverflow) -> Self
fn from(v: TextOverflow) -> Self
Converts to this type from the input type.
Source§impl From<TextStrokeStyle> for Value
impl From<TextStrokeStyle> for Value
Source§fn from(v: TextStrokeStyle) -> Self
fn from(v: TextStrokeStyle) -> Self
Converts to this type from the input type.
Source§impl From<TextVerticalAlignment> for Value
impl From<TextVerticalAlignment> for Value
Source§fn from(v: TextVerticalAlignment) -> Self
fn from(v: TextVerticalAlignment) -> Self
Converts to this type from the input type.
Source§impl TryFrom<Value> for AccessibleRole
impl TryFrom<Value> for AccessibleRole
Source§impl TryFrom<Value> for AnimationDirection
impl TryFrom<Value> for AnimationDirection
Source§impl TryFrom<Value> for ColorScheme
impl TryFrom<Value> for ColorScheme
Source§impl TryFrom<Value> for ComponentFactory
impl TryFrom<Value> for ComponentFactory
Source§impl TryFrom<Value> for DialogButtonRole
impl TryFrom<Value> for DialogButtonRole
Source§impl TryFrom<Value> for EasingCurve
impl TryFrom<Value> for EasingCurve
Source§impl TryFrom<Value> for EventResult
impl TryFrom<Value> for EventResult
Source§impl TryFrom<Value> for FocusReason
impl TryFrom<Value> for FocusReason
Source§impl TryFrom<Value> for FontMetrics
impl TryFrom<Value> for FontMetrics
Source§impl TryFrom<Value> for ImageHorizontalAlignment
impl TryFrom<Value> for ImageHorizontalAlignment
Source§impl TryFrom<Value> for ImageRendering
impl TryFrom<Value> for ImageRendering
Source§impl TryFrom<Value> for ImageTiling
impl TryFrom<Value> for ImageTiling
Source§impl TryFrom<Value> for ImageVerticalAlignment
impl TryFrom<Value> for ImageVerticalAlignment
Source§impl TryFrom<Value> for KeyboardModifiers
impl TryFrom<Value> for KeyboardModifiers
Source§impl TryFrom<Value> for LayoutAlignment
impl TryFrom<Value> for LayoutAlignment
Source§impl TryFrom<Value> for LayoutInfo
impl TryFrom<Value> for LayoutInfo
Source§impl TryFrom<Value> for LogicalLength
impl TryFrom<Value> for LogicalLength
Source§impl TryFrom<Value> for LogicalPosition
impl TryFrom<Value> for LogicalPosition
Source§impl TryFrom<Value> for MouseCursor
impl TryFrom<Value> for MouseCursor
Source§impl TryFrom<Value> for OperatingSystemType
impl TryFrom<Value> for OperatingSystemType
Source§impl TryFrom<Value> for Orientation
impl TryFrom<Value> for Orientation
Source§impl TryFrom<Value> for PointerEvent
impl TryFrom<Value> for PointerEvent
Source§impl TryFrom<Value> for PointerEventButton
impl TryFrom<Value> for PointerEventButton
Source§impl TryFrom<Value> for PointerEventKind
impl TryFrom<Value> for PointerEventKind
Source§impl TryFrom<Value> for PointerScrollEvent
impl TryFrom<Value> for PointerScrollEvent
Source§impl TryFrom<Value> for PopupClosePolicy
impl TryFrom<Value> for PopupClosePolicy
Source§impl TryFrom<Value> for ScrollBarPolicy
impl TryFrom<Value> for ScrollBarPolicy
Source§impl TryFrom<Value> for StandardButtonKind
impl TryFrom<Value> for StandardButtonKind
Source§impl TryFrom<Value> for StandardListViewItem
impl TryFrom<Value> for StandardListViewItem
Source§impl TryFrom<Value> for TableColumn
impl TryFrom<Value> for TableColumn
Source§impl TryFrom<Value> for TextHorizontalAlignment
impl TryFrom<Value> for TextHorizontalAlignment
Source§impl TryFrom<Value> for TextOverflow
impl TryFrom<Value> for TextOverflow
Source§impl TryFrom<Value> for TextStrokeStyle
impl TryFrom<Value> for TextStrokeStyle
Source§impl TryFrom<Value> for TextVerticalAlignment
impl TryFrom<Value> for TextVerticalAlignment
impl ValueType for Value
Auto Trait Implementations§
impl Freeze for Value
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl !UnwindSafe for Value
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more