Trait StackImmut

Source
pub trait StackImmut<T>: Sized {
    // Required methods
    fn push(&self, _: T) -> Self;
    fn pop(&self) -> Self;
    fn top(&self) -> Option<&T>;

    // Provided method
    fn pop_and_top(&self) -> (Self, Option<&T>) { ... }
}

Required Methods§

Source

fn push(&self, _: T) -> Self

Source

fn pop(&self) -> Self

Source

fn top(&self) -> Option<&T>

Provided Methods§

Source

fn pop_and_top(&self) -> (Self, Option<&T>)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§