Skip to main content

ArrayOps

Struct ArrayOps 

Source
pub struct ArrayOps;
Expand description

Operations on array objects.

Implementations§

Source§

impl ArrayOps

Source

pub fn len(obj: &RtObject) -> Option<usize>

Get the length of an array.

Source

pub fn is_empty(obj: &RtObject) -> Option<bool>

Check if an array is empty.

Source

pub fn get(obj: &RtObject, index: usize) -> Option<RtObject>

Get an element by index.

Source

pub fn set(obj: &RtObject, index: usize, value: RtObject) -> Option<RtObject>

Set an element by index (in-place if unique, otherwise copy).

Source

pub fn push(obj: &RtObject, value: RtObject) -> Option<RtObject>

Push an element onto the end of an array.

Source

pub fn pop(obj: &RtObject) -> Option<(RtObject, RtObject)>

Pop the last element from an array.

Source

pub fn mk_array(size: usize, default: RtObject) -> RtObject

Create an array of the given size filled with a default value.

Source

pub fn concat(a: &RtObject, b: &RtObject) -> Option<RtObject>

Concatenate two arrays.

Source

pub fn slice(obj: &RtObject, start: usize, end: usize) -> Option<RtObject>

Slice an array.

Source

pub fn reverse(obj: &RtObject) -> Option<RtObject>

Reverse an array.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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