[−][src]Enum canonical_collections::Stack
Proof of concept stack structure using a self-referential repr
Variants
Represents an empty stack.
Non-empty top node
Fields of Node
value: T
The value on top of the stack
prev: Repr<Self, S>
A repr referencing the previous state of the stack
Implementations
impl<T, S> Stack<T, S> where
S: Store,
T: Canon<S> + Clone,
[src]
S: Store,
T: Canon<S> + Clone,
pub fn new() -> Self
[src]
Creates a new Stack
pub fn push(&mut self, t: T)
[src]
Pushes a value to the stack
pub fn pop(&mut self) -> Result<Option<T>, S::Error>
[src]
Pops a value from the stack, if any and returns it
Trait Implementations
impl<T: Canon<S>, S: Store + Canon<S>> Canon<S> for Stack<T, S>
[src]
fn write(&self, sink: &mut impl Sink<S>) -> Result<(), S::Error>
[src]
fn read(source: &mut impl Source<S>) -> Result<Self, S::Error>
[src]
fn encoded_len(&self) -> usize
[src]
impl<T: Clone, S: Clone + Store> Clone for Stack<T, S>
[src]
fn clone(&self) -> Stack<T, S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug, S: Debug + Store> Debug for Stack<T, S>
[src]
Auto Trait Implementations
impl<T, S> Send for Stack<T, S> where
T: Send,
<S as Store>::Ident: Send,
T: Send,
<S as Store>::Ident: Send,
impl<T, S> Sync for Stack<T, S> where
T: Sync,
<S as Store>::Ident: Sync,
T: Sync,
<S as Store>::Ident: Sync,
impl<T, S> Unpin for Stack<T, S> where
T: Unpin,
<S as Store>::Ident: Unpin,
T: Unpin,
<S as Store>::Ident: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,