Trait flatcontainer::impls::offsets::OffsetContainer

source ·
pub trait OffsetContainer<T>: Default + Extend<T> {
    // Required methods
    fn push(&mut self, item: T);
    fn index(&self, index: usize) -> T;
    fn clear(&mut self);
    fn len(&self) -> usize;
    fn reserve(&mut self, additional: usize);
    fn heap_size<F: FnMut(usize, usize)>(&self, callback: F);

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A container to store offsets.

Required Methods§

source

fn push(&mut self, item: T)

Accepts a newly pushed element.

source

fn index(&self, index: usize) -> T

Lookup an index. May panic for invalid indexes.

source

fn clear(&mut self)

Clear all contents.

source

fn len(&self) -> usize

Returns the number of elements.

source

fn reserve(&mut self, additional: usize)

Reserve space for additional elements.

source

fn heap_size<F: FnMut(usize, usize)>(&self, callback: F)

Heap size, size - capacity

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if empty.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: Copy> OffsetContainer<T> for Vec<T>

source§

fn push(&mut self, item: T)

source§

fn index(&self, index: usize) -> T

source§

fn clear(&mut self)

source§

fn len(&self) -> usize

source§

fn reserve(&mut self, additional: usize)

source§

fn heap_size<F: FnMut(usize, usize)>(&self, callback: F)

Implementors§