Trait nalgebra::base::allocator::Reallocator
source · pub trait Reallocator<T: Scalar, RFrom: Dim, CFrom: Dim, RTo: Dim, CTo: Dim>: Allocator<RFrom, CFrom> + Allocator<RTo, CTo> {
// Required method
unsafe fn reallocate_copy(
nrows: RTo,
ncols: CTo,
buf: <Self as Allocator<RFrom, CFrom>>::Buffer<T>
) -> <Self as Allocator<RTo, CTo>>::BufferUninit<T>;
}
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§
sourceunsafe fn reallocate_copy(
nrows: RTo,
ncols: CTo,
buf: <Self as Allocator<RFrom, CFrom>>::Buffer<T>
) -> <Self as Allocator<RTo, CTo>>::BufferUninit<T>
unsafe fn reallocate_copy( nrows: RTo, ncols: CTo, buf: <Self as Allocator<RFrom, CFrom>>::Buffer<T> ) -> <Self as Allocator<RTo, CTo>>::BufferUninit<T>
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.
Object Safety§
This trait is not object safe.