Struct same_alloc::SameVec[][src]

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

A dynamically sized buffer for types with the same layout.

Implementations

impl<T> SameVec<T>[src]

pub fn new() -> Self[src]

Create an empty buffer.

pub fn with_capacity(cap: usize) -> Self[src]

Create a buffer with a pre-defined capacity.

This buffer will not need to reallocate until the element count required for any temporary vector exceeds this number of elements.

pub fn use_for<U>(&mut self, marker: SameLayout<T, U>) -> TempVec<'_, U>[src]

Use the allocated buffer for a compatible type of elements.

When the temporary view is dropped the allocation is returned to the buffer. This means its capacity might be automatically increased, or decreased, based on the used of the vector.

Trait Implementations

impl<T> Default for SameVec<T>[src]

Auto Trait Implementations

impl<T> Send for SameVec<T> where
    T: Send

impl<T> Sync for SameVec<T> where
    T: Sync

impl<T> Unpin for SameVec<T> where
    T: 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, 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.