pub struct RantOrderedCollection(/* private fields */);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
pub const INFINITY: Self
pub const NEG_INFINITY: Self
pub const MIN_FLOAT: Self
pub const MAX_FLOAT: Self
pub const EPSILON: Self
pub const MIN_INT: Self
pub const MAX_INT: Self
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:
boolreturns itself.intreturnstruefor any non-zero value; otherwise,false.floatreturnstruefor any normal value; otherwise,false.emptyreturnsfalse.- Collections that can be zero-length (
string,list,map,range) returntrueif 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§
Source§impl Clone for RantOrderedCollection
impl Clone for RantOrderedCollection
Source§fn clone(&self) -> RantOrderedCollection
fn clone(&self) -> RantOrderedCollection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RantOrderedCollection
impl Debug for RantOrderedCollection
Source§impl Deref for RantOrderedCollection
impl Deref for RantOrderedCollection
Source§impl PartialEq for RantOrderedCollection
impl PartialEq for RantOrderedCollection
Source§impl PartialOrd for RantOrderedCollection
impl PartialOrd for RantOrderedCollection
Source§impl TryFromRant for RantOrderedCollection
impl TryFromRant for RantOrderedCollection
Source§fn try_from_rant(val: RantValue) -> Result<Self, ValueError>
fn try_from_rant(val: RantValue) -> Result<Self, ValueError>
Convert from a
RantValue.Source§fn 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 !Freeze for RantOrderedCollection
impl !RefUnwindSafe for RantOrderedCollection
impl !Send for RantOrderedCollection
impl !Sync for RantOrderedCollection
impl Unpin for RantOrderedCollection
impl !UnwindSafe for RantOrderedCollection
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