Struct rant::RantOrderedCollection
source · [−]pub struct RantOrderedCollection(_);
Expand description
Filter type that represents any indexable (ordered) Rant collection type.
Use on native functions to accept any ordered collection type. Derefs to RantValue
.
Methods from Deref<Target = RantValue>
pub const NAN: Self = Self::Float(f64::NAN)
pub const INFINITY: Self = Self::Float(f64::INFINITY)
pub const NEG_INFINITY: Self = Self::Float(f64::NEG_INFINITY)
pub const MIN_FLOAT: Self = Self::Float(f64::MIN)
pub const MAX_FLOAT: Self = Self::Float(f64::MAX)
pub const EPSILON: Self = Self::Float(f64::EPSILON)
pub const MIN_INT: Self = Self::Int(i64::MIN)
pub const MAX_INT: Self = Self::Int(i64::MAX)
sourcepub fn is_nothing(&self) -> bool
pub fn is_nothing(&self) -> bool
Returns true if the value is of type nothing
.
sourcepub fn is_callable(&self) -> bool
pub fn is_callable(&self) -> bool
Returns true if the value is callable (e.g. a function).
sourcepub fn to_bool(&self) -> bool
pub fn to_bool(&self) -> bool
Interprets this value as a boolean value according to Rant’s truthiness rules.
Types are converted as follows:
bool
returns itself.int
returnstrue
for any non-zero value; otherwise,false
.float
returnstrue
for any normal value; otherwise,false
.empty
returnsfalse
.- Collections that can be zero-length (
string
,list
,map
,range
) returntrue
if their length is nonzero; otherwise,false
. - All other types return
true
.
pub fn reversed(&self) -> Self
sourcepub fn shallow_copy(&self) -> Self
pub fn shallow_copy(&self) -> Self
Returns a shallow copy of the value.
sourcepub fn get_type(&self) -> RantValueType
pub fn get_type(&self) -> RantValueType
Gets the Rant type associated with the value.
pub fn slice_get(&self, slice: &Slice) -> ValueSliceResult
sourcepub fn is_indexable(&self) -> bool
pub fn is_indexable(&self) -> bool
Indicates whether the value can be indexed into.
sourcepub fn index_get(&self, index: i64) -> ValueIndexResult
pub fn index_get(&self, index: i64) -> ValueIndexResult
Attempts to get a value by index.
sourcepub fn key_get(&self, key: &str) -> ValueKeyResult
pub fn key_get(&self, key: &str) -> ValueKeyResult
Attempts to get a value by key.
Trait Implementations
sourceimpl Clone for RantOrderedCollection
impl Clone for RantOrderedCollection
sourcefn clone(&self) -> RantOrderedCollection
fn clone(&self) -> RantOrderedCollection
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RantOrderedCollection
impl Debug for RantOrderedCollection
sourceimpl Deref for RantOrderedCollection
impl Deref for RantOrderedCollection
sourceimpl PartialEq<RantOrderedCollection> for RantOrderedCollection
impl PartialEq<RantOrderedCollection> for RantOrderedCollection
sourcefn eq(&self, other: &RantOrderedCollection) -> bool
fn eq(&self, other: &RantOrderedCollection) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RantOrderedCollection) -> bool
fn ne(&self, other: &RantOrderedCollection) -> bool
This method tests for !=
.
sourceimpl PartialOrd<RantOrderedCollection> for RantOrderedCollection
impl PartialOrd<RantOrderedCollection> for RantOrderedCollection
sourcefn partial_cmp(&self, other: &RantOrderedCollection) -> Option<Ordering>
fn partial_cmp(&self, other: &RantOrderedCollection) -> 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
sourceimpl TryFromRant for RantOrderedCollection
impl TryFromRant for RantOrderedCollection
sourcefn try_from_rant(val: RantValue) -> Result<Self, ValueError>
fn try_from_rant(val: RantValue) -> Result<Self, ValueError>
Convert from a RantValue
.
sourcefn is_optional_param_type() -> bool
fn is_optional_param_type() -> bool
Returns true
if the type can be used to represent an optional Rant parameter in native functions; otherwise, false
.
impl StructuralPartialEq for RantOrderedCollection
Auto Trait Implementations
impl !RefUnwindSafe for RantOrderedCollection
impl !Send for RantOrderedCollection
impl !Sync for RantOrderedCollection
impl Unpin for RantOrderedCollection
impl !UnwindSafe for RantOrderedCollection
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more