syntree

Trait Storage

Source
pub trait Storage<T>
where Self: Sized + DerefMut<Target = [T]>,
{ type Error: 'static; const EMPTY: Self; // Required methods fn with_capacity(capacity: usize) -> Result<Self, Self::Error>; fn capacity(&self) -> usize; fn push(&mut self, item: T) -> Result<(), Self::Error>; }
Expand description

Storage being used in a tree.

Required Associated Constants§

Source

const EMPTY: Self

Empty storage.

Required Associated Types§

Source

type Error: 'static

A storage error.

Required Methods§

Source

fn with_capacity(capacity: usize) -> Result<Self, Self::Error>

Constructstorage with the given capacity.

Source

fn capacity(&self) -> usize

Get the capacity of the underlying storage.

Source

fn push(&mut self, item: T) -> Result<(), Self::Error>

Push an item into storage.

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.

Implementations on Foreign Types§

Source§

impl<T> Storage<T> for Vec<T>

Source§

const EMPTY: Self = _

Source§

type Error = Infallible

Source§

fn with_capacity(capacity: usize) -> Result<Self, Self::Error>

Source§

fn capacity(&self) -> usize

Source§

fn push(&mut self, item: T) -> Result<(), Self::Error>

Implementors§

Source§

impl<T> Storage<T> for EmptyVec<T>

Source§

const EMPTY: Self = _

Source§

type Error = Infallible