Struct brane_exe::stack::StackSlice

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

Represents a slice of the Stack.

Implementations§

source§

impl 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 Debug for StackSlice

source§

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

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

impl Index<Range<usize>> for StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 StackSlice

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 ToOwned for StackSlice

source§

type Owned = Stack

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Stack

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

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

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