Reallocator in nalgebra::base::allocator - Rust
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`).
Keywords: rust, rustlang, rust-lang, Reallocator

# Trait nalgebra::base::allocator::Reallocator

source ·

    pub trait Reallocator<T: Scalar, RFrom: Dim, CFrom: Dim, RTo: Dim, CTo: Dim>: Allocator<T, RFrom, CFrom> + Allocator<T, RTo, CTo> {
        unsafe fn reallocate_copy(
            nrows: RTo,
            ncols: CTo,
            buf: <Self as Allocator<T, RFrom, CFrom>>::Buffer
        ) -> <Self as Allocator<T, RTo, CTo>>::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 as Allocator<T, RFrom, CFrom>>::Buffer
) -> <Self as Allocator<T, RTo, CTo>>::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: Scalar, CFrom: Dim, CTo: Dim> Reallocator<T, Dyn, CFrom, Dyn, CTo> for DefaultAllocator

source§

### impl<T: Scalar, CFrom: Dim, RTo: DimName> Reallocator<T, Dyn, CFrom, RTo, Dyn> for DefaultAllocator

source§

### impl<T: Scalar, CTo, const RFROM: usize, const CFROM: usize> Reallocator<T, Const<RFROM>, Const<CFROM>, Dyn, CTo> for DefaultAllocator where
CTo: Dim,

source§

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

source§

### impl<T: Scalar, RFrom: DimName, CTo: Dim> Reallocator<T, RFrom, Dyn, Dyn, CTo> for DefaultAllocator

source§

### impl<T: Scalar, RFrom: DimName, RTo: DimName> Reallocator<T, RFrom, Dyn, RTo, Dyn> for DefaultAllocator

source§

### impl<T: Scalar, RTo, const RFROM: usize, const CFROM: usize> Reallocator<T, Const<RFROM>, Const<CFROM>, RTo, Dyn> for DefaultAllocator where
RTo: DimName,