flex_alloc::vec::config

Struct Custom

Source
pub struct Custom<A: Allocator, I: Index = usize, G: Grow = GrowExact> { /* private fields */ }
Expand description

Parameterize Vec with a custom index type or growth behavior.

Trait Implementations§

Source§

impl<A: AllocatorDefault, I: Index, G: Grow> ConstDefault for Custom<A, I, G>

Source§

const DEFAULT: Self = _

An instance of this custom Vec definition, which may be used as an allocation target.

Source§

impl<A: Debug + Allocator, I: Debug + Index, G: Debug + Grow> Debug for Custom<A, I, G>

Source§

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

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

impl<A: Default + Allocator, I: Default + Index, G: Default + Grow> Default for Custom<A, I, G>

Source§

fn default() -> Custom<A, I, G>

Returns the “default value” for a type. Read more
Source§

impl<A: Allocator, I: Index, G: Grow> VecConfig for Custom<A, I, G>

Source§

type Buffer<T> = FatBuffer<T, VecHeader<I>, A>

The internal buffer type.
Source§

type Grow = G

The growth strategy.
Source§

type Index = I

The index type used to define the capacity and length.
Source§

impl<T, A: AllocatorDefault, I: Index, G: Grow> VecConfigNew<T> for Custom<A, I, G>

Source§

const EMPTY_BUFFER: Self::Buffer<T> = FatBuffer::DEFAULT

Constant initializer for an empty buffer.
Source§

fn buffer_try_new( capacity: Self::Index, exact: bool, ) -> Result<Self::Buffer<T>, StorageError>

Try to create a new buffer instance with a given capacity.
Source§

impl<T, A: Allocator + Clone, I: Index, G: Grow> VecConfigSpawn<T> for Custom<A, I, G>

Source§

fn buffer_try_spawn( buf: &Self::Buffer<T>, capacity: Self::Index, exact: bool, ) -> Result<Self::Buffer<T>, StorageError>

Try to create a new buffer instance with a given capacity.
Source§

impl<T, A: Allocator, I: Index, G: Grow> VecNewIn<T> for Custom<A, I, G>

Source§

type Config = Custom<A, I, G>

The associated Vec configuration type.
Source§

fn buffer_try_new_in( self, capacity: <Self::Config as VecConfig>::Index, exact: bool, ) -> Result<<Self::Config as VecConfig>::Buffer<T>, StorageError>

Try to create a new buffer given an allocation target.

Auto Trait Implementations§

§

impl<A, I, G> Freeze for Custom<A, I, G>
where A: Freeze,

§

impl<A, I, G> RefUnwindSafe for Custom<A, I, G>

§

impl<A, I, G> Send for Custom<A, I, G>
where A: Send, G: Send,

§

impl<A, I, G> Sync for Custom<A, I, G>
where A: Sync, G: Sync,

§

impl<A, I, G> Unpin for Custom<A, I, G>
where A: Unpin, I: Unpin, G: Unpin,

§

impl<A, I, G> UnwindSafe for Custom<A, I, G>
where A: UnwindSafe, I: UnwindSafe, G: 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> 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, 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.