#[repr(u8)]pub enum ValueType {
Bool(bool),
Int(i32),
Float(f32),
List(InkList),
String(StringValue),
DivertTarget(Path),
VariablePointer(VariablePointerValue),
}Expand description
An Ink value, tagged with its type.
Variants§
Bool(bool)
Int(i32)
Float(f32)
List(InkList)
An Ink list value.
String(StringValue)
Ink string, constructed with new_string
DivertTarget(Path)
Reference to an Ink divert.
VariablePointer(VariablePointerValue)
Reference to an Ink variable.
Implementations§
Source§impl ValueType
impl ValueType
pub fn new<T: Into<ValueType>>(v: T) -> Self
pub fn get<'val, T>(&'val self) -> Option<T>where
&'val Self: TryInto<T>,
Sourcepub fn coerce_to_int(&self) -> Result<i32, StoryError>
pub fn coerce_to_int(&self) -> Result<i32, StoryError>
Tries to convert the internal value of this ValueType to i32
Sourcepub fn coerce_to_float(&self) -> Result<f32, StoryError>
pub fn coerce_to_float(&self) -> Result<f32, StoryError>
Tries to convert the internal value of this ValueType to f32
Sourcepub fn coerce_to_bool(&self) -> Result<bool, StoryError>
pub fn coerce_to_bool(&self) -> Result<bool, StoryError>
Tries to convert the internal value of this ValueType to bool
Sourcepub fn coerce_to_string(&self) -> Result<String, StoryError>
pub fn coerce_to_string(&self) -> Result<String, StoryError>
Tries to convert the internal value of this ValueType to String
Trait Implementations§
Source§impl From<VariablePointerValue> for ValueType
impl From<VariablePointerValue> for ValueType
Source§fn from(value: VariablePointerValue) -> Self
fn from(value: VariablePointerValue) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for ValueType
impl !RefUnwindSafe for ValueType
impl Send for ValueType
impl !Sync for ValueType
impl Unpin for ValueType
impl UnsafeUnpin for ValueType
impl UnwindSafe for ValueType
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