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 TryInto
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
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<DialogButtonRole> for Value
impl From<DialogButtonRole> for Value
sourcefn from(v: DialogButtonRole) -> Self
fn from(v: DialogButtonRole) -> Self
Performs the conversion.
sourceimpl From<EasingCurve> for Value
impl From<EasingCurve> for Value
sourcefn from(v: EasingCurve) -> Self
fn from(v: EasingCurve) -> Self
Performs the conversion.
sourceimpl From<EventResult> for Value
impl From<EventResult> for Value
sourcefn from(v: EventResult) -> Self
fn from(v: EventResult) -> Self
Performs the conversion.
sourceimpl From<ImageRendering> for Value
impl From<ImageRendering> for Value
sourcefn from(v: ImageRendering) -> Self
fn from(v: ImageRendering) -> Self
Performs the conversion.
sourceimpl From<KeyEventType> for Value
impl From<KeyEventType> for Value
sourcefn from(v: KeyEventType) -> Self
fn from(v: KeyEventType) -> Self
Performs the conversion.
sourceimpl From<KeyboardModifiers> for Value
impl From<KeyboardModifiers> for Value
sourcefn from(_: KeyboardModifiers) -> Self
fn from(_: KeyboardModifiers) -> Self
Performs the conversion.
sourceimpl From<LayoutAlignment> for Value
impl From<LayoutAlignment> for Value
sourcefn from(v: LayoutAlignment) -> Self
fn from(v: LayoutAlignment) -> Self
Performs the conversion.
sourceimpl From<LayoutInfo> for Value
impl From<LayoutInfo> for Value
sourcefn from(_: LayoutInfo) -> Self
fn from(_: LayoutInfo) -> Self
Performs the conversion.
sourceimpl From<MouseCursor> for Value
impl From<MouseCursor> for Value
sourcefn from(v: MouseCursor) -> Self
fn from(v: MouseCursor) -> Self
Performs the conversion.
sourceimpl From<PointerEvent> for Value
impl From<PointerEvent> for Value
sourcefn from(_: PointerEvent) -> Self
fn from(_: PointerEvent) -> Self
Performs the conversion.
sourceimpl From<PointerEventButton> for Value
impl From<PointerEventButton> for Value
sourcefn from(v: PointerEventButton) -> Self
fn from(v: PointerEventButton) -> Self
Performs the conversion.
sourceimpl From<PointerEventKind> for Value
impl From<PointerEventKind> for Value
sourcefn from(v: PointerEventKind) -> Self
fn from(v: PointerEventKind) -> Self
Performs the conversion.
sourcefn from(v: SharedString) -> Self
fn from(v: SharedString) -> Self
Performs the conversion.
sourcefn from(v: SharedVector<f32>) -> Self
fn from(v: SharedVector<f32>) -> Self
Performs the conversion.
sourceimpl From<StandardButtonKind> for Value
impl From<StandardButtonKind> for Value
sourcefn from(v: StandardButtonKind) -> Self
fn from(v: StandardButtonKind) -> Self
Performs the conversion.
sourceimpl From<StandardListViewItem> for Value
impl From<StandardListViewItem> for Value
sourcefn from(_: StandardListViewItem) -> Self
fn from(_: StandardListViewItem) -> Self
Performs the conversion.
sourceimpl From<TextHorizontalAlignment> for Value
impl From<TextHorizontalAlignment> for Value
sourcefn from(v: TextHorizontalAlignment) -> Self
fn from(v: TextHorizontalAlignment) -> Self
Performs the conversion.
sourceimpl From<TextOverflow> for Value
impl From<TextOverflow> for Value
sourcefn from(v: TextOverflow) -> Self
fn from(v: TextOverflow) -> Self
Performs the conversion.
sourceimpl From<TextVerticalAlignment> for Value
impl From<TextVerticalAlignment> for Value
sourcefn from(v: TextVerticalAlignment) -> Self
fn from(v: TextVerticalAlignment) -> Self
Performs the conversion.
sourceimpl TryInto<DialogButtonRole> for Value
impl TryInto<DialogButtonRole> for Value
sourceimpl TryInto<EasingCurve> for Value
impl TryInto<EasingCurve> for Value
sourceimpl TryInto<EventResult> for Value
impl TryInto<EventResult> for Value
sourceimpl TryInto<ImageRendering> for Value
impl TryInto<ImageRendering> for Value
sourceimpl TryInto<KeyEventType> for Value
impl TryInto<KeyEventType> for Value
sourceimpl TryInto<KeyboardModifiers> for Value
impl TryInto<KeyboardModifiers> for Value
sourceimpl TryInto<LayoutAlignment> for Value
impl TryInto<LayoutAlignment> for Value
sourceimpl TryInto<LayoutInfo> for Value
impl TryInto<LayoutInfo> for Value
sourceimpl TryInto<MouseCursor> for Value
impl TryInto<MouseCursor> for Value
sourceimpl TryInto<PointerEvent> for Value
impl TryInto<PointerEvent> for Value
sourceimpl TryInto<PointerEventButton> for Value
impl TryInto<PointerEventButton> for Value
sourceimpl TryInto<PointerEventKind> for Value
impl TryInto<PointerEventKind> for Value
sourceimpl TryInto<StandardButtonKind> for Value
impl TryInto<StandardButtonKind> for Value
sourceimpl TryInto<StandardListViewItem> for Value
impl TryInto<StandardListViewItem> for Value
sourceimpl TryInto<TextHorizontalAlignment> for Value
impl TryInto<TextHorizontalAlignment> for Value
sourceimpl TryInto<TextOverflow> for Value
impl TryInto<TextOverflow> for Value
sourceimpl TryInto<TextVerticalAlignment> for Value
impl TryInto<TextVerticalAlignment> for Value
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
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()
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more