Enum sixtyfps_interpreter::Value [−][src]
#[non_exhaustive]
#[repr(C)]
pub enum Value {
Void,
Number(f64),
String(SharedString),
Bool(bool),
Image(Image),
Array(SharedVector<Value>),
Model(Rc<dyn Model<Data = Value>>),
Struct(Struct),
Brush(Brush),
// some variants omitted
}
Expand description
This is a dynamically typed value used in the SixtyFPS 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
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
)
Tuple Fields of Number
0: f64
String(SharedString)
Correspond to the string
type in .60
Tuple Fields of String
0: SharedString
Bool(bool)
Correspond to the bool
type in .60
Tuple Fields of Bool
0: bool
Image(Image)
Correspond to the image
type in .60
Tuple Fields of Image
0: Image
Array(SharedVector<Value>)
An Array in the .60 language.
Tuple Fields of Array
0: SharedVector<Value>
A more complex model which is not created by the interpreter itself (Value::Array can also be used for models)
Struct(Struct)
An object
Tuple Fields of Struct
0: Struct
Brush(Brush)
Correspond to brush
or color
type in .60. For color, this is then a Brush::SolidColor
Tuple Fields of Brush
0: Brush
Implementations
Returns the type variant that this value holds without the containing value.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
FIXME: use SharedArray instead?
Auto Trait Implementations
impl !RefUnwindSafe for Value
impl !UnwindSafe for Value
Blanket Implementations
Mutably borrows from an owned value. Read more