[][src]Struct dynamization::Dynamic

pub struct Dynamic<Container, S = Binary> { /* fields omitted */ }

A dynamic version of Container.

Implementations

impl<Container: Static, S: Strategy> Dynamic<Container, S>[src]

pub fn new() -> Self[src]

A new container with a default initial unit count.

pub fn with_unit_count(unit_count: usize) -> Self[src]

A new container with a specified initial unit count.

pub fn add_unit(&mut self, container: Container)[src]

Adds a new unit (partial container).

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

Total size of the container.

It is calculated as a sum of partial lengths. Usually can be replaced without much hassle by a variable tracking insertions/deletions.

pub fn is_empty(&self) -> bool[src]

Returns true if there are no elements.

Warning: this function queries all the units. It's much better to replace this function with a variable tracking insertions/deletions.

pub fn units(&self) -> Units<'_, Container>

Notable traits for Units<'a, Container>

impl<'a, Container> Iterator for Units<'a, Container> type Item = &'a Container;
[src]

Iterator over all the partial containers. Shared-reference version.

pub fn units_mut(&mut self) -> UnitsMut<'_, Container>

Notable traits for UnitsMut<'a, Container>

impl<'a, Container> Iterator for UnitsMut<'a, Container> type Item = &'a mut Container;
[src]

Iterator over all the partial containers. Unique-reference version.

pub fn try_collect(self) -> Option<Container>[src]

Collects all the partial containers into a single one.

Returns None if there are no units.

pub fn clear(&mut self)[src]

Clears all the partial containers.

impl<Container: Static + Singleton, S: Strategy> Dynamic<Container, S>[src]

pub fn insert(&mut self, item: Container::Item)[src]

Inserts a single item.

Requires Singleton to be implemented for the container type.

Trait Implementations

impl<Container: Clone, S: Clone> Clone for Dynamic<Container, S>[src]

impl<Container: Debug, S: Debug> Debug for Dynamic<Container, S>[src]

impl<Container, S> IntoIterator for Dynamic<Container, S>[src]

type Item = Container

The type of the elements being iterated over.

type IntoIter = DynamicIntoIter<Container>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<Container, S> Send for Dynamic<Container, S> where
    Container: Send,
    S: Send

impl<Container, S> Sync for Dynamic<Container, S> where
    Container: Sync,
    S: Sync

impl<Container, S> Unpin for Dynamic<Container, S> where
    Container: Unpin,
    S: Unpin

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.