Enum slint_interpreter::Value
source · [−]#[non_exhaustive]
#[repr(C)]
pub enum Value {
Void,
Number(f64),
String(SharedString),
Bool(bool),
Image(Image),
Model(ModelRc<Value>),
Struct(Struct),
Brush(Brush),
// some variants omitted
}
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
There is nothing in this value. That’s the default. For example, a function that do 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
sourceimpl Value
impl Value
sourcepub fn value_type(&self) -> ValueType
pub fn value_type(&self) -> ValueType
Returns the type variant that this value holds without the containing value.
Trait Implementations
sourceimpl From<AccessibleRole> for Value
impl From<AccessibleRole> for Value
sourcefn from(v: AccessibleRole) -> Self
fn from(v: AccessibleRole) -> Self
Converts to this type from the input type.
sourceimpl From<DialogButtonRole> for Value
impl From<DialogButtonRole> for Value
sourcefn from(v: DialogButtonRole) -> Self
fn from(v: DialogButtonRole) -> Self
Converts to this type from the input type.
sourceimpl From<EasingCurve> for Value
impl From<EasingCurve> for Value
sourcefn from(v: EasingCurve) -> Self
fn from(v: EasingCurve) -> Self
Converts to this type from the input type.
sourceimpl From<EventResult> for Value
impl From<EventResult> for Value
sourcefn from(v: EventResult) -> Self
fn from(v: EventResult) -> Self
Converts to this type from the input type.
sourceimpl From<ImageRendering> for Value
impl From<ImageRendering> for Value
sourcefn from(v: ImageRendering) -> Self
fn from(v: ImageRendering) -> Self
Converts to this type from the input type.
sourceimpl From<KeyboardModifiers> for Value
impl From<KeyboardModifiers> for Value
sourcefn from(_: KeyboardModifiers) -> Self
fn from(_: KeyboardModifiers) -> Self
Converts to this type from the input type.
sourceimpl From<LayoutAlignment> for Value
impl From<LayoutAlignment> for Value
sourcefn from(v: LayoutAlignment) -> Self
fn from(v: LayoutAlignment) -> Self
Converts to this type from the input type.
sourceimpl From<LayoutInfo> for Value
impl From<LayoutInfo> for Value
sourcefn from(_: LayoutInfo) -> Self
fn from(_: LayoutInfo) -> Self
Converts to this type from the input type.
sourceimpl From<Length<f32, LogicalPx>> for Value
impl From<Length<f32, LogicalPx>> for Value
sourcefn from(l: LogicalLength) -> Self
fn from(l: LogicalLength) -> Self
Converts to this type from the input type.
sourceimpl From<MouseCursor> for Value
impl From<MouseCursor> for Value
sourcefn from(v: MouseCursor) -> Self
fn from(v: MouseCursor) -> Self
Converts to this type from the input type.
sourceimpl From<PointerEvent> for Value
impl From<PointerEvent> for Value
sourcefn from(_: PointerEvent) -> Self
fn from(_: PointerEvent) -> Self
Converts to this type from the input type.
sourceimpl From<PointerEventButton> for Value
impl From<PointerEventButton> for Value
sourcefn from(v: PointerEventButton) -> Self
fn from(v: PointerEventButton) -> Self
Converts to this type from the input type.
sourceimpl From<PointerEventKind> for Value
impl From<PointerEventKind> for Value
sourcefn from(v: PointerEventKind) -> Self
fn from(v: PointerEventKind) -> Self
Converts to this type from the input type.
sourcefn from(v: SharedString) -> Self
fn from(v: SharedString) -> Self
Converts to this type from the input type.
sourcefn from(v: SharedVector<f32>) -> Self
fn from(v: SharedVector<f32>) -> Self
Converts to this type from the input type.
sourceimpl From<StandardButtonKind> for Value
impl From<StandardButtonKind> for Value
sourcefn from(v: StandardButtonKind) -> Self
fn from(v: StandardButtonKind) -> Self
Converts to this type from the input type.
sourceimpl From<StandardListViewItem> for Value
impl From<StandardListViewItem> for Value
sourcefn from(_: StandardListViewItem) -> Self
fn from(_: StandardListViewItem) -> Self
Converts to this type from the input type.
sourceimpl From<TextHorizontalAlignment> for Value
impl From<TextHorizontalAlignment> for Value
sourcefn from(v: TextHorizontalAlignment) -> Self
fn from(v: TextHorizontalAlignment) -> Self
Converts to this type from the input type.
sourceimpl From<TextOverflow> for Value
impl From<TextOverflow> for Value
sourcefn from(v: TextOverflow) -> Self
fn from(v: TextOverflow) -> Self
Converts to this type from the input type.
sourceimpl From<TextVerticalAlignment> for Value
impl From<TextVerticalAlignment> for Value
sourcefn from(v: TextVerticalAlignment) -> Self
fn from(v: TextVerticalAlignment) -> Self
Converts to this type from the input type.
sourceimpl TryFrom<Value> for AccessibleRole
impl TryFrom<Value> for AccessibleRole
sourceimpl TryFrom<Value> for DialogButtonRole
impl TryFrom<Value> for DialogButtonRole
sourceimpl TryFrom<Value> for EasingCurve
impl TryFrom<Value> for EasingCurve
sourceimpl TryFrom<Value> for EventResult
impl TryFrom<Value> for EventResult
sourceimpl TryFrom<Value> for ImageRendering
impl TryFrom<Value> for ImageRendering
sourceimpl TryFrom<Value> for KeyboardModifiers
impl TryFrom<Value> for KeyboardModifiers
sourceimpl TryFrom<Value> for LayoutAlignment
impl TryFrom<Value> for LayoutAlignment
sourceimpl TryFrom<Value> for LayoutInfo
impl TryFrom<Value> for LayoutInfo
sourceimpl TryFrom<Value> for LogicalLength
impl TryFrom<Value> for LogicalLength
sourceimpl TryFrom<Value> for MouseCursor
impl TryFrom<Value> for MouseCursor
sourceimpl TryFrom<Value> for PointerEvent
impl TryFrom<Value> for PointerEvent
sourceimpl TryFrom<Value> for PointerEventButton
impl TryFrom<Value> for PointerEventButton
sourceimpl TryFrom<Value> for PointerEventKind
impl TryFrom<Value> for PointerEventKind
sourceimpl TryFrom<Value> for StandardButtonKind
impl TryFrom<Value> for StandardButtonKind
sourceimpl TryFrom<Value> for StandardListViewItem
impl TryFrom<Value> for StandardListViewItem
sourceimpl TryFrom<Value> for TextHorizontalAlignment
impl TryFrom<Value> for TextHorizontalAlignment
sourceimpl TryFrom<Value> for TextOverflow
impl TryFrom<Value> for TextOverflow
sourceimpl TryFrom<Value> for TextVerticalAlignment
impl TryFrom<Value> for TextVerticalAlignment
impl ValueType for Value
Auto Trait Implementations
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl !UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_big_endian()
.sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_native_endian()
.