pub trait Allocator<T: Scalar, R: Dim, C: Dim = U1>: Any + Sized {
    type Buffer: ContiguousStorageMut<T, R, C> + Clone;

    // Required methods
    unsafe fn allocate_uninitialized(
        nrows: R,
        ncols: C
    ) -> MaybeUninit<Self::Buffer>;
    fn allocate_from_iterator<I: IntoIterator<Item = T>>(
        nrows: R,
        ncols: C,
        iter: I
    ) -> Self::Buffer;
}
Expand description

A matrix allocator of a memory buffer that may contain R::to_usize() * C::to_usize() elements of type T.

An allocator is said to be: − static: if R and C both implement DimName. − dynamic: if either one (or both) of R or C is equal to Dynamic.

Every allocator must be both static and dynamic. Though not all implementations may share the same Buffer type.

Required Associated Types§

source

type Buffer: ContiguousStorageMut<T, R, C> + Clone

The type of buffer this allocator can instanciate.

Required Methods§

source

unsafe fn allocate_uninitialized( nrows: R, ncols: C ) -> MaybeUninit<Self::Buffer>

Allocates a buffer with the given number of rows and columns without initializing its content.

source

fn allocate_from_iterator<I: IntoIterator<Item = T>>( nrows: R, ncols: C, iter: I ) -> Self::Buffer

Allocates a buffer initialized with the content of the given iterator.

Implementors§

source§

impl<T: Scalar, C: Dim> Allocator<T, Dynamic, C> for DefaultAllocator

source§

impl<T: Scalar, R: DimName> Allocator<T, R, Dynamic> for DefaultAllocator

source§

impl<T: Scalar, const R: usize, const C: usize> Allocator<T, Const<R>, Const<C>> for DefaultAllocator

§

type Buffer = ArrayStorage<T, R, C>