Expand description
An algebraic data type that can be used to represent many types of values that can be present in
a Stack
.
Scriptful supports customization of value types through generics, yet this enum
is
provided in expectation that some users will prefer not to define their own type systems but
rather use a stock solution.
Value
has four variants that should cover most use cases, namely: Boolean
,
Float
, Integer
or String
.
The point of Value
is being used inside Script
s (wrapped in an Item
) or
to be pushed into a Stack
.
Value
does not implement any methods other than implementations of some traits from the
core
crate.
Variants
Boolean(bool)
A binary value: either true
or false
.
Float(f64)
A signed floating point value.
Integer(i128)
A signed integer value.
String(String)
A string of characters.
Trait Implementations
sourceimpl PartialEq<Value> for Value
impl PartialEq<Value> for Value
Approximate comparison, so as to support comparison of floating point values.
A floating point values is considered equal to another float or an integer if the difference is
less than 10^9
.
sourceimpl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
sourcefn partial_cmp(&self, other: &Value) -> Option<Ordering>
fn partial_cmp(&self, other: &Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more