Struct brane_exe::stack::Stack

source ·
pub struct Stack { /* private fields */ }
Expand description

The stack itself.

Implementations§

source§

impl Stack

source

pub fn new(size: usize) -> Self

Constructor for the Stack.

§Arguments
  • size: The size of the stack. This is actually non-configurable during execution.
§Returns

A new instance of a Stack with size slots available.

source

pub fn pop(&mut self) -> Option<Value>

Returns the top value of the stack, popping it.

§Returns

The top value of the stack, or None if the stack (slice) is empty.

source

pub fn dpop(&mut self) -> Vec<Value>

Dynamically pops from the stack until (and not including) it encounters a value that is marked with a pop marker.

§Returns

The top X values from the stack (where X is the number of slots before a pop marked appears).

§Panics

This function panics if there was no pop marked at all.

source

pub fn push<V: Into<Value>>(&mut self, value: V) -> Result<(), Error>

Pushes a new value on top of the stack.

§Generic arguments
  • V: The Value-compatible type of the value.
§Arguments
  • value: The value to push onto the stack.
§Errors

This function may error if the stack is growing too large.

source

pub fn push_pop_marker(&mut self) -> Result<(), Error>

Pushes a new pop marker on top of the stack.

§Errors

This function may error if the stack is growing too large.

source

pub fn insert<V: Into<Value>>( &mut self, index: usize, value: V, ) -> Result<(), Error>

Inserts a new value at the given position in the stack.

§Generic arguments
  • V: The Value-compatible type of the value.
§Arguments
  • index: The position in which to insert the value. Any values following (and including) this index will be shifted one place to the right.
  • value: The value to push onto the stack.
§Errors

This function may error if the stack is growing too large.

Methods from Deref<Target = StackSlice>§

source

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

Returns the top value of the stack without popping it.

§Returns

The top value of the stack, or None if the stack (slice) is empty.

source

pub fn len(&self) -> usize

The number of elements in this slice.

source

pub fn is_empty(&self) -> bool

Returns whether this slice is empty or not (i.e., has zero-length)

source

pub fn iter(&mut self) -> impl Iterator<Item = &Value>

Returns a reference-iterator for the slice.

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Value>

Returns a muteable reference-iterator for the slice.

Trait Implementations§

source§

impl Borrow<StackSlice> for Stack

source§

fn borrow(&self) -> &StackSlice

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<StackSlice> for Stack

source§

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

Mutably borrows from an owned value. Read more
source§

impl Clone for Stack

source§

fn clone(&self) -> Stack

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 Stack

source§

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

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

impl Deref for Stack

source§

type Target = StackSlice

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl DerefMut for Stack

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Index<Range<usize>> for Stack

source§

type Output = StackSlice

The returned type after indexing.
source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeFrom<usize>> for Stack

source§

type Output = StackSlice

The returned type after indexing.
source§

fn index(&self, index: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeFull> for Stack

source§

type Output = StackSlice

The returned type after indexing.
source§

fn index(&self, _index: RangeFull) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeInclusive<usize>> for Stack

source§

type Output = StackSlice

The returned type after indexing.
source§

fn index(&self, index: RangeInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeTo<usize>> for Stack

source§

type Output = StackSlice

The returned type after indexing.
source§

fn index(&self, index: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeToInclusive<usize>> for Stack

source§

type Output = StackSlice

The returned type after indexing.
source§

fn index(&self, index: RangeToInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<usize> for Stack

source§

type Output = Value

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<Range<usize>> for Stack

source§

fn index_mut(&mut self, index: Range<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeFrom<usize>> for Stack

source§

fn index_mut(&mut self, index: RangeFrom<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeFull> for Stack

source§

fn index_mut(&mut self, _index: RangeFull) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeInclusive<usize>> for Stack

source§

fn index_mut(&mut self, index: RangeInclusive<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeTo<usize>> for Stack

source§

fn index_mut(&mut self, index: RangeTo<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeToInclusive<usize>> for Stack

source§

fn index_mut(&mut self, index: RangeToInclusive<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Stack

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<'a> IntoIterator for &'a Stack

source§

type IntoIter = FilterMap<Iter<'a, StackSlot>, fn(_: &'a StackSlot) -> Option<&'a Value>>

Which kind of iterator are we turning this into?
source§

type Item = &'a Value

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a> IntoIterator for &'a mut Stack

source§

type IntoIter = FilterMap<IterMut<'a, StackSlot>, fn(_: &'a mut StackSlot) -> Option<&'a mut Value>>

Which kind of iterator are we turning this into?
source§

type Item = &'a mut Value

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for Stack

source§

type IntoIter = FilterMap<IntoIter<StackSlot>, fn(_: StackSlot) -> Option<Value>>

Which kind of iterator are we turning this into?
source§

type Item = Value

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T