RantOrderedCollection

Struct RantOrderedCollection 

Source
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>§

Source

pub const NAN: Self

Source

pub const INFINITY: Self

Source

pub const NEG_INFINITY: Self

Source

pub const MIN_FLOAT: Self

Source

pub const MAX_FLOAT: Self

Source

pub const EPSILON: Self

Source

pub const MIN_INT: Self

Source

pub const MAX_INT: Self

Source

pub fn is_nothing(&self) -> bool

Returns true if the value is of type nothing.

Source

pub fn is_nan(&self) -> bool

Returns true if the value is NaN (Not a Number).

Source

pub fn is_callable(&self) -> bool

Returns true if the value is callable (e.g. a function).

Source

pub fn to_bool(&self) -> bool

Interprets this value as a boolean value according to Rant’s truthiness rules.

Types are converted as follows:

  1. bool returns itself.
  2. int returns true for any non-zero value; otherwise, false.
  3. float returns true for any normal value; otherwise, false.
  4. empty returns false.
  5. Collections that can be zero-length (string, list, map, range) return true if their length is nonzero; otherwise, false.
  6. All other types return true.
Source

pub fn len(&self) -> usize

Gets the length of the value.

Source

pub fn is_empty(&self) -> bool

Returns true if the length of the value is 0.

Source

pub fn reversed(&self) -> Self

Source

pub fn shallow_copy(&self) -> Self

Returns a shallow copy of the value.

Source

pub fn get_type(&self) -> RantValueType

Gets the Rant type associated with the value.

Source

pub fn type_name(&self) -> &'static str

Gets the type name of the value.

Source

pub fn slice_get(&self, slice: &Slice) -> ValueSliceResult

Source

pub fn is_indexable(&self) -> bool

Indicates whether the value can be indexed into.

Source

pub fn index_get(&self, index: i64) -> ValueIndexResult

Attempts to get a value by index.

Source

pub fn key_get(&self, key: &str) -> ValueKeyResult

Attempts to get a value by key.

Trait Implementations§

Source§

impl Clone for RantOrderedCollection

Source§

fn clone(&self) -> RantOrderedCollection

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RantOrderedCollection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for RantOrderedCollection

Source§

type Target = RantValue

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl PartialEq for RantOrderedCollection

Source§

fn eq(&self, other: &RantOrderedCollection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for RantOrderedCollection

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFromRant for RantOrderedCollection

Source§

fn try_from_rant(val: RantValue) -> Result<Self, ValueError>

Convert from a RantValue.
Source§

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.
Source§

impl StructuralPartialEq for RantOrderedCollection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRantArgs for T
where T: TryFromRant,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V