Skip to main content

VecConfigAlloc

Trait VecConfigAlloc 

Source
pub trait VecConfigAlloc<T>: VecConfig {
    type Alloc: Allocator;

    // Required methods
    fn allocator(buf: &Self::Buffer<T>) -> &Self::Alloc;
    fn buffer_from_parts(
        data: NonNull<T>,
        length: Self::Index,
        capacity: Self::Index,
        alloc: Self::Alloc,
    ) -> Self::Buffer<T>;
    fn buffer_into_parts(
        buffer: Self::Buffer<T>,
    ) -> (NonNull<T>, Self::Index, Self::Index, Self::Alloc);
}
Expand description

Configuration for Vec types supporting an allocator.

Required Associated Types§

Source

type Alloc: Allocator

The allocator instance type.

Required Methods§

Source

fn allocator(buf: &Self::Buffer<T>) -> &Self::Alloc

Get a reference to the allocator instance.

Source

fn buffer_from_parts( data: NonNull<T>, length: Self::Index, capacity: Self::Index, alloc: Self::Alloc, ) -> Self::Buffer<T>

Create a Vec buffer instance from its constituent parts.

Source

fn buffer_into_parts( buffer: Self::Buffer<T>, ) -> (NonNull<T>, Self::Index, Self::Index, Self::Alloc)

Disassemble a Vec buffer instance into its constituent parts.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, A: Allocator, I: Index, G: Grow> VecConfigAlloc<T> for Thin<A, I, G>

Source§

type Alloc = A

Source§

impl<T, A: Allocator> VecConfigAlloc<T> for A

Source§

type Alloc = A