Struct budvm::List

source ·
pub struct List(_);
Expand description

A List type for Bud, which wraps a VecDeque<Value>.

This type uses a Mutex for interior mutability, allowing lists to be cheaply moved around by reference. Each interaction with this type locks the Mutex.

VecDeque was chosen to allow users ultimate flexibility in pushing/popping without worry about performance concerns.

Implementations§

source§

impl List

source

pub fn into_inner(self) -> VecDeque<Value>

Extracts the contained collection type.

source

pub fn push_front(&self, value: Value)

Pushes value to the front of the list.

source

pub fn push_back(&self, value: Value)

Pushes value to the back of the list.

source

pub fn pop_front(&self) -> Option<Value>

Removes the first value in the list.

source

pub fn pop_back(&self) -> Option<Value>

Removes the last value in the list.

source

pub fn len(&self) -> usize

Returns the number of values contained in the list.

source

pub fn is_empty(&self) -> bool

Returns true if this list contains no values.

source

pub fn get(&self, index: usize) -> Option<Value>

Returns the value contained at index, or None if index is outside of the bounds of this list.

source

pub fn remove(&self, index: usize) -> Option<Value>

Removes the value contained at index, or None if index is outside of the bounds of this list.

Trait Implementations§

source§

impl Clone for List

source§

fn clone(&self) -> Self

Returns a copy 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 List

source§

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

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

impl DynamicValue for List

source§

fn is_truthy(&self) -> bool

Returns true if the value contained is truthy. See Value::is_truthy() for examples of what this means for primitive types.
source§

fn kind(&self) -> Symbol

Returns a unique string identifying this type. This returned string will be wrapped in ValueKind::Dynamic when Value::kind() is invoked on a dynamic value. Read more
source§

fn partial_eq(&self, other: &Value) -> Option<bool>

Returns true if self and other are considered equal. Returns false if self and other are able to be compared but are not equal. Returns None if the values are unable to be compared. Read more
source§

fn partial_cmp(&self, other: &Value) -> Option<Ordering>

Returns the relative ordering of self and other, if a comparison is able to be made. If the types cannot be compared, this function should return None. Read more
source§

fn call( &self, name: &Symbol, args: &mut PoppedValues<'_> ) -> Result<Value, FaultKind>

Calls a function by name with args.
source§

fn to_source(&self) -> Option<String>

Returns this value as represented in source, if possible.
source§

fn hash<H>(&self, state: &mut H) -> boolwhere H: Hasher,

Hashes the contents of this value. Returns true if this operation is supported. Read more
source§

fn as_i64(&self) -> Option<i64>

Returns this value as an i64, if possible. Read more
source§

fn convert(&self, kind: &Symbol) -> Option<Value>

Converts this value to the given kind, if possible. Read more
source§

fn checked_add( &self, other: &Value, is_reverse: bool ) -> Result<Option<Value>, FaultKind>

Attempts to compute the result adding self and other. Read more
source§

fn checked_sub( &self, other: &Value, is_reverse: bool ) -> Result<Option<Value>, FaultKind>

Attempts to compute the result subtracting self and other. Read more
source§

fn checked_mul( &self, other: &Value, is_reverse: bool ) -> Result<Option<Value>, FaultKind>

Attempts to compute the result multiplying self and other. Read more
source§

fn checked_div( &self, other: &Value, is_reverse: bool ) -> Result<Option<Value>, FaultKind>

Attempts to compute the result dividing self and other. Read more
source§

impl FromIterator<Value> for List

source§

fn from_iter<T: IntoIterator<Item = Value>>(iter: T) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for List

§

impl Send for List

§

impl Sync for List

§

impl Unpin for List

§

impl UnwindSafe for List

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromStack for Twhere T: DynamicValue + Clone,

source§

fn from_value(value: Value) -> Result<T, FaultKind>

Returns an instance constructing from the stack.
source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.