[][src]Struct wired::Stack

pub struct Stack<T> { /* fields omitted */ }

a Last-In-First-Out data structure

A Stack is backed by a memory-mapped file, so the full content does not reside in RAM when not needed. It is type-safe over a generic type that can be serialized through serde.

What exactly is a Stack?

In computer science, a stack is an abstract data type that serves as a collection of elements, with two principal operations:

  • push, which adds an element to the collection, and
  • pop, which removes the most recently added element that was not yet removed.

The order in which elements come off a stack gives rise to its alternative name, LIFO (last in, first out). Additionally, a peek operation may give access to the top without modifying the stack. The name "stack" for this type of structure comes from the analogy to a set of physical items stacked on top of each other, which makes it easy to take an item off the top of the stack, while getting to an item deeper in the stack may require taking off multiple other items first.

-- Wikipedia

Methods

impl<T> Stack<T> where
    T: Serialize,
    T: Deserialize<'de>, 
[src]

pub fn new(path: &str) -> Result<Self, Box<dyn Error>>[src]

pub fn len(&self) -> usize[src]

pub fn wasted_file_space(&self) -> f64[src]

pub fn push(&mut self, data: &T) -> Result<(), Box<dyn Error>>[src]

pub fn pop(&mut self) -> Result<Option<T>, Box<dyn Error>>[src]

pub fn compact(&mut self) -> Result<(), Box<dyn Error>>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Stack<T>

impl<T> !Send for Stack<T>

impl<T> !Sync for Stack<T>

impl<T> Unpin for Stack<T> where
    T: Unpin

impl<T> !UnwindSafe for Stack<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,