nyx_space::linalg::allocator

Trait Reallocator

Source
pub trait Reallocator<T, RFrom, CFrom, RTo, CTo>: Allocator<RFrom, CFrom> + Allocator<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<T>, ) -> Self::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§

Source

unsafe fn reallocate_copy( nrows: RTo, ncols: CTo, buf: Self::Buffer<T>, ) -> Self::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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, CFrom, CTo> Reallocator<T, Dyn, CFrom, Dyn, CTo> for DefaultAllocator
where T: Scalar, CFrom: Dim, CTo: Dim,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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