pub struct Stacked<T> { /* private fields */ }Expand description
A helper type to implement the Stack trait
This type is a wrapper for any clonable type T that implements Stack on top of it.
Access to the current topmost frame is granted via Deref and DerefMut.
The stack structure is implemented as a vector where the current value of the inner object is
pushed when Stack::push is called, and popped when Stack::pop_n is called. This means that
types used with Stacked should be efficiently clonable. Efficient clonability is often
achieved in formally by using immutable/persistent data structures, usually from the rpds
crate.
To construct a Stacked object, the underlying type must implement Default. The Stack traits suggests that popping out more frames than those pushed should result into an object equivalent to the Default instance. This requirement is satisfied by Stacked.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Stacked<T>
impl<T> RefUnwindSafe for Stacked<T>
impl<T> Send for Stacked<T>
impl<T> Sync for Stacked<T>
impl<T> Unpin for Stacked<T>
impl<T> UnsafeUnpin for Stacked<T>
impl<T> UnwindSafe for Stacked<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more