pub trait Reallocator<T, RFrom, CFrom, RTo, CTo>: Allocator<T, RFrom, CFrom> + Allocator<T, RTo, CTo>where
    T: Scalar,
    RFrom: Dim,
    CFrom: Dim,
    RTo: Dim,
    CTo: Dim,{
    // Required method
    unsafe fn reallocate_copy(
        nrows: RTo,
        ncols: CTo,
        buf: Self::Buffer
    ) -> Self::BufferUninit;
}
Expand description

A matrix reallocator. Changes the size of the memory buffer that initially contains (RFrom × CFrom) elements to a smaller or larger size (RTo, CTo).

Required Methods§

source

unsafe fn reallocate_copy( nrows: RTo, ncols: CTo, buf: Self::Buffer ) -> Self::BufferUninit

Reallocates a buffer of shape (RTo, CTo), possibly reusing a previously allocated buffer buf. Data stored by buf are linearly copied to the output:

Safety

The following invariants must be respected by the implementors of this method:

  • The copy is performed as if both were just arrays (without taking into account the matrix structure).
  • If the underlying buffer is being shrunk, the removed elements must not be dropped by this method. Dropping them is the responsibility of the caller.

Implementors§

source§

impl<T, CFrom, CTo> Reallocator<T, Dynamic, CFrom, Dynamic, CTo> for DefaultAllocatorwhere T: Scalar, CFrom: Dim, CTo: Dim,

source§

impl<T, CFrom, RTo> Reallocator<T, Dynamic, CFrom, RTo, Dynamic> for DefaultAllocatorwhere T: Scalar, CFrom: Dim, RTo: DimName,

source§

impl<T, CTo, const RFROM: usize, const CFROM: usize> Reallocator<T, Const<RFROM>, Const<CFROM>, Dynamic, CTo> for DefaultAllocatorwhere T: Scalar, CTo: Dim,

source§

impl<T, RFrom, CFrom, const RTO: usize, const CTO: usize> Reallocator<T, RFrom, CFrom, Const<RTO>, Const<CTO>> for DefaultAllocatorwhere T: Scalar, RFrom: Dim, CFrom: Dim, DefaultAllocator: Allocator<T, RFrom, CFrom>,

source§

impl<T, RFrom, CTo> Reallocator<T, RFrom, Dynamic, Dynamic, CTo> for DefaultAllocatorwhere T: Scalar, RFrom: DimName, CTo: Dim,

source§

impl<T, RFrom, RTo> Reallocator<T, RFrom, Dynamic, RTo, Dynamic> for DefaultAllocatorwhere T: Scalar, RFrom: DimName, RTo: DimName,

source§

impl<T, RTo, const RFROM: usize, const CFROM: usize> Reallocator<T, Const<RFROM>, Const<CFROM>, RTo, Dynamic> for DefaultAllocatorwhere T: Scalar, RTo: DimName,