Struct Stack

Source
pub struct Stack {
    pub items: Vec<RcStackValue>,
}
Expand description

A stack of values.

Fields§

§items: Vec<RcStackValue>

Implementations§

Source§

impl Stack

Source

pub const MAX_DEPTH: usize = 16_777_215usize

Source

pub fn make_null() -> RcStackValue

Source

pub fn make_nan() -> RcStackValue

Source

pub fn make_empty_tuple() -> RcStackValue

Source

pub fn make_zero() -> RcStackValue

Source

pub fn make_minus_one() -> RcStackValue

Source

pub fn make_one() -> RcStackValue

Source

pub fn make_bool(value: bool) -> RcStackValue

Source

pub fn load_stack_value_from_cell(cell: &DynCell) -> Result<RcStackValue, Error>

Loads stack value from the cell. Returns an error if data was not fully used.

Source

pub fn load_stack_value( slice: &mut CellSlice<'_>, ) -> Result<RcStackValue, Error>

Loads stack value from the slice advancing its cursors.

Source

pub fn with_items(items: Vec<RcStackValue>) -> Self

Source

pub fn depth(&self) -> usize

Source

pub fn display_dump(&self, verbose: bool) -> impl Display + '_

Source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted.

Source

pub fn push<T: StackValue + 'static>(&mut self, item: T) -> VmResult<()>

Source

pub fn push_raw<T: StackValue + ?Sized + 'static>( &mut self, item: SafeRc<T>, ) -> VmResult<()>

Source

pub fn push_opt<T: StackValue + 'static>( &mut self, value: Option<T>, ) -> VmResult<()>

Source

pub fn push_opt_raw<T: StackValue + ?Sized + 'static>( &mut self, item: Option<SafeRc<T>>, ) -> VmResult<()>

Source

pub fn push_nth(&mut self, idx: usize) -> VmResult<()>

Source

pub fn push_null(&mut self) -> VmResult<()>

Source

pub fn push_nan(&mut self) -> VmResult<()>

Source

pub fn push_bool(&mut self, value: bool) -> VmResult<()>

Source

pub fn push_zero(&mut self) -> VmResult<()>

Source

pub fn push_int<T: Into<BigInt>>(&mut self, value: T) -> VmResult<()>

Source

pub fn push_raw_int( &mut self, value: SafeRc<BigInt>, quiet: bool, ) -> VmResult<()>

Source

pub fn move_from_stack(&mut self, other: &mut Self, n: usize) -> VmResult<()>

Source

pub fn split_top(&mut self, n: usize) -> VmResult<SafeRc<Self>>

Source

pub fn split_top_ext(&mut self, n: usize, drop: usize) -> VmResult<SafeRc<Self>>

Source

pub fn pop(&mut self) -> VmResult<RcStackValue>

Source

pub fn pop_bool(&mut self) -> VmResult<bool>

Source

pub fn pop_int(&mut self) -> VmResult<SafeRc<BigInt>>

Source

pub fn pop_int_or_nan(&mut self) -> VmResult<Option<SafeRc<BigInt>>>

Source

pub fn pop_smallint_range(&mut self, min: u32, max: u32) -> VmResult<u32>

Source

pub fn pop_long_range(&mut self, min: u64, max: u64) -> VmResult<u64>

Source

pub fn pop_smallint_signed_range(&mut self, min: i32, max: i32) -> VmResult<i32>

Source

pub fn pop_smallint_signed_range_or_null( &mut self, min: i32, max: i32, ) -> VmResult<Option<i32>>

Source

pub fn pop_tuple(&mut self) -> VmResult<SafeRc<Tuple>>

Source

pub fn pop_tuple_range( &mut self, min_len: u32, max_len: u32, ) -> VmResult<SafeRc<Tuple>>

Source

pub fn pop_opt_tuple_range( &mut self, min_len: u32, max_len: u32, ) -> VmResult<Option<SafeRc<Tuple>>>

Source

pub fn pop_cont(&mut self) -> VmResult<RcCont>

Source

pub fn pop_cs(&mut self) -> VmResult<SafeRc<OwnedCellSlice>>

Source

pub fn pop_builder(&mut self) -> VmResult<SafeRc<CellBuilder>>

Source

pub fn pop_cell(&mut self) -> VmResult<SafeRc<Cell>>

Source

pub fn pop_cell_opt(&mut self) -> VmResult<Option<SafeRc<Cell>>>

Source

pub fn pop_many(&mut self, n: usize) -> VmResult<()>

Source

pub fn drop_bottom(&mut self, n: usize) -> VmResult<()>

Source

pub fn swap(&mut self, lhs: usize, rhs: usize) -> VmResult<()>

Source

pub fn reverse_range(&mut self, offset: usize, n: usize) -> VmResult<()>

Source

pub fn fetch(&self, idx: usize) -> VmResult<&RcStackValue>

Source

pub fn get_exit_arg(&self) -> Option<i32>

Trait Implementations§

Source§

impl Clone for Stack

Source§

fn clone(&self) -> Stack

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 Stack

Source§

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

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

impl Default for Stack

Source§

fn default() -> Stack

Returns the “default value” for a type. Read more
Source§

impl FromIterator<SafeRc<dyn StackValue>> for Stack

Source§

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

Creates a value from an iterator. Read more
Source§

impl<'a> Load<'a> for Stack

Source§

fn load_from(slice: &mut CellSlice<'a>) -> Result<Self, Error>

Tries to load itself from a cell slice.
Source§

impl SafeRcMakeMut for Stack

Source§

fn rc_make_mut(rc: &mut Rc<Self>) -> &mut Self

Source§

impl Store for Stack

Source§

fn store_into( &self, builder: &mut CellBuilder, context: &dyn CellContext, ) -> Result<(), Error>

Tries to store itself into the cell builder.

Auto Trait Implementations§

§

impl Freeze for Stack

§

impl !RefUnwindSafe for Stack

§

impl !Send for Stack

§

impl !Sync for Stack

§

impl Unpin for Stack

§

impl !UnwindSafe for Stack

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> SafeDelete for T
where T: 'static,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<T> EquivalentRepr<T> for T