Enum rant::RantValue [−][src]
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]
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]
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]
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 Add<RantValue> for RantValue
[src]
type Output = RantValue
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
impl Clone for RantValue
[src]
impl Debug for RantValue
[src]
impl Default for RantValue
[src]
impl Display for RantValue
[src]
impl Div<RantValue> for RantValue
[src]
type Output = ValueResult<RantValue>
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self::Output
[src]
impl Eq for RantValue
[src]
impl FromIterator<RantValue> for RantList
[src]
fn from_iter<T: IntoIterator<Item = RantValue>>(iter: T) -> Self
[src]
impl FromRant for RantValue
[src]
fn from_rant(val: RantValue) -> ValueResult<Self>
[src]
fn is_rant_optional() -> bool
[src]
impl Mul<RantValue> for RantValue
[src]
type Output = RantValue
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self::Output
[src]
impl Neg for RantValue
[src]
type Output = RantValue
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl Not for RantValue
[src]
type Output = Self
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
impl PartialEq<RantValue> for RantValue
[src]
impl PartialOrd<RantValue> for RantValue
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Rem<RantValue> for RantValue
[src]
type Output = ValueResult<RantValue>
The resulting type after applying the %
operator.
fn rem(self, rhs: Self) -> Self::Output
[src]
impl Sub<RantValue> for RantValue
[src]
Auto Trait Implementations
impl !RefUnwindSafe for RantValue
[src]
impl !Send for RantValue
[src]
impl !Sync for RantValue
[src]
impl Unpin for RantValue
[src]
impl !UnwindSafe for RantValue
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,