Struct Dynamic

Source
pub struct Dynamic<Container, S = Binary> { /* private fields */ }
Expand description

A dynamic version of Container.

Implementations§

Source§

impl<Container: Static, S: Strategy> Dynamic<Container, S>

Source

pub fn new() -> Self

A new container with a default initial unit count.

Source

pub fn with_unit_count(unit_count: usize) -> Self

A new container with a specified initial unit count.

Source

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

Adds a new unit (partial container).

Source

pub fn len(&self) -> usize

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.

Source

pub fn is_empty(&self) -> bool

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.

Source

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

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

Source

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

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

Source

pub fn try_collect(self) -> Option<Container>

Collects all the partial containers into a single one.

Returns None if there are no units.

Source

pub fn clear(&mut self)

Clears all the partial containers.

Source§

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

Source

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

Inserts a single item.

Requires Singleton to be implemented for the container type.

Trait Implementations§

Source§

impl<Container: Clone, S: Clone> Clone for Dynamic<Container, S>

Source§

fn clone(&self) -> Dynamic<Container, S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Container: Debug, S: Debug> Debug for Dynamic<Container, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Container, S> IntoIterator for Dynamic<Container, S>

Source§

type Item = Container

The type of the elements being iterated over.
Source§

type IntoIter = DynamicIntoIter<Container>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.