pub struct RantyOrderedCollection(/* private fields */);Expand description
Filter type that represents any indexable (ordered) Ranty collection type.
Use on native functions to accept any ordered collection type. Derefs to RantyValue.
Methods from Deref<Target = RantyValue>§
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 Ranty’s truthiness rules.
Types are converted as follows:
boolreturns itself.intreturnstruefor any non-zero value; otherwise,false.floatreturnstruefor any nonzero, non-NaN 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) -> RantyValueType
pub fn get_type(&self) -> RantyValueType
Gets the Ranty 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 RantyOrderedCollection
impl Clone for RantyOrderedCollection
Source§fn clone(&self) -> RantyOrderedCollection
fn clone(&self) -> RantyOrderedCollection
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 RantyOrderedCollection
impl Debug for RantyOrderedCollection
Source§impl Deref for RantyOrderedCollection
impl Deref for RantyOrderedCollection
Source§impl PartialEq for RantyOrderedCollection
impl PartialEq for RantyOrderedCollection
Source§impl PartialOrd for RantyOrderedCollection
impl PartialOrd for RantyOrderedCollection
Source§impl TryFromRanty for RantyOrderedCollection
impl TryFromRanty for RantyOrderedCollection
Source§fn try_from_ranty(val: RantyValue) -> Result<Self, ValueError>
fn try_from_ranty(val: RantyValue) -> Result<Self, ValueError>
Convert from a
RantyValue.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 Ranty parameter in native functions; otherwise, false.impl StructuralPartialEq for RantyOrderedCollection
Auto Trait Implementations§
impl !Freeze for RantyOrderedCollection
impl !RefUnwindSafe for RantyOrderedCollection
impl !Send for RantyOrderedCollection
impl !Sync for RantyOrderedCollection
impl Unpin for RantyOrderedCollection
impl UnsafeUnpin for RantyOrderedCollection
impl UnwindSafe for RantyOrderedCollection
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