Enum rant::RantValue [−][src]
pub enum RantValue { String(RantString), Float(f64), Int(i64), Boolean(bool), Function(RantFunctionRef), Block(Rc<Block>), List(RantListRef), Map(RantMapRef), Range(RantRange), Special(RantSpecial), Empty, }
A dynamically-typed Rant value.
Cloning
It is important to note that calling clone()
on a RantValue
will only result in a shallow clone of the data.
Since collection types like list
and map
are represented by handles to their actual contents, cloning these will
only make copies of these handles; both copies will still point to the same data.
Variants
String(RantString)
A Rant value of type string
. Passed by-value.
Float(f64)
A Rant value of type float
. Passed by-value.
Int(i64)
A Rant value of type int
. Passed by-value.
Boolean(bool)
A Rant value of type bool
. Passed by-value.
Function(RantFunctionRef)
A Rant value of type function
. Passed by-reference.
Block(Rc<Block>)
A Rant value of type block
. Passed by-reference.
List(RantListRef)
A Rant value of type list
. Passed by-reference.
Map(RantMapRef)
A Rant value of type map
. Passed by-reference.
Range(RantRange)
A Rant value of type range
. Passed by-value.
Special(RantSpecial)
A Rant value of type special
. Passed by-value.
A Rant unit value of type empty
. Passed by-value.
Implementations
impl RantValue
[src]
impl RantValue
[src]pub fn nan() -> Self
[src]
Returns NaN (Not a Number).
pub fn is_empty(&self) -> bool
[src]
Returns true if the value is of type empty
.
pub fn is_nan(&self) -> bool
[src]
Returns true if the value is NaN (Not a Number).
pub fn is_callable(&self) -> bool
[src]
Returns true if the value is callable (e.g. a function).
impl RantValue
[src]
impl RantValue
[src]pub fn into_rant_int(self) -> RantValue
[src]
Converts to a Rant int
value (or empty
if the conversion fails).
pub fn into_rant_float(self) -> RantValue
[src]
Converts to a Rant float
value (or empty
if the conversion fails).
pub fn into_rant_string(self) -> RantValue
[src]
Converts to a Rant string
value.
pub fn into_rant_list(self) -> RantValue
[src]
Converts to a Rant list
value.
pub fn len(&self) -> usize
[src]
Gets the length of the value.
pub fn reversed(&self) -> Self
[src]
pub fn shallow_copy(&self) -> Self
[src]
Returns a shallow copy of the value.
pub fn get_type(&self) -> RantValueType
[src]
Gets the Rant type associated with the value.
pub fn type_name(&self) -> &'static str
[src]
Gets the type name of the value.
pub fn slice_get(&self, slice: &Slice) -> ValueSliceResult
[src]
pub fn slice_set(
&mut self,
slice: &Slice,
val: RantValue
) -> ValueSliceSetResult
[src]
&mut self,
slice: &Slice,
val: RantValue
) -> ValueSliceSetResult
pub fn is_indexable(&self) -> bool
[src]
Indicates whether the value can be indexed into.
pub fn index_get(&self, index: i64) -> ValueIndexResult
[src]
Attempts to get a value by index.
pub fn index_set(&mut self, index: i64, val: RantValue) -> ValueIndexSetResult
[src]
Attempts to set a value by index.
pub fn key_get(&self, key: &str) -> ValueKeyResult
[src]
Attempts to get a value by key.
pub fn key_set(&mut self, key: &str, val: RantValue) -> ValueKeySetResult
[src]
Attempts to set a value by key.
impl RantValue
[src]
impl RantValue
[src]pub fn pow(self, exponent: RantValue) -> ValueResult<Self>
[src]
Raises self
to the exponent
power.
pub fn abs(self) -> ValueResult<Self>
[src]
Calculates the absolute value.
Trait Implementations
impl FromIterator<RantValue> for RantList
[src]
impl FromIterator<RantValue> for RantList
[src]fn from_iter<T: IntoIterator<Item = RantValue>>(iter: T) -> Self
[src]
impl FromRant for RantValue
[src]
impl FromRant for RantValue
[src]fn from_rant(val: RantValue) -> ValueResult<Self>
[src]
fn is_rant_optional() -> bool
[src]
impl PartialOrd<RantValue> for RantValue
[src]
impl PartialOrd<RantValue> for RantValue
[src]Auto Trait Implementations
impl !RefUnwindSafe for RantValue
impl !RefUnwindSafe for RantValue
impl !UnwindSafe for RantValue
impl !UnwindSafe for RantValue
Blanket Implementations
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,