Enum slint_interpreter::Value
source ยท 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ยง
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ยง
Trait Implementationsยง
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 PartialEq<Value> for Value
impl PartialEq<Value> 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ยง
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
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
ยงfn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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
.ยง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
.ยง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.ยง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>
ยง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
sourceยงimpl<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,
sourceยงfn 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()
.