pub trait AsRawBuffer {
// Required methods
fn raw_ptr(&self) -> *const u8;
fn raw_shape(&self) -> &[usize];
fn raw_strides_bytes(&self) -> Vec<isize>;
fn raw_dtype(&self) -> DType;
fn is_c_contiguous(&self) -> bool;
fn is_f_contiguous(&self) -> bool;
// Provided method
fn buffer_descriptor(&self) -> BufferDescriptor<'_> { ... }
}Expand description
Trait exposing the raw memory layout of an array for zero-copy interop.
Implementors provide enough information for foreign code (C, Python/NumPy, Arrow, etc.) to read the array data without copying.
Required Methods§
Sourcefn raw_strides_bytes(&self) -> Vec<isize>
fn raw_strides_bytes(&self) -> Vec<isize>
Strides in bytes (not elements).
Sourcefn is_c_contiguous(&self) -> bool
fn is_c_contiguous(&self) -> bool
Whether the data is C-contiguous.
Sourcefn is_f_contiguous(&self) -> bool
fn is_f_contiguous(&self) -> bool
Whether the data is Fortran-contiguous.
Provided Methods§
Sourcefn buffer_descriptor(&self) -> BufferDescriptor<'_>
fn buffer_descriptor(&self) -> BufferDescriptor<'_>
Build a BufferDescriptor aggregating every field above into
a single FFI-safe struct (#358). Default impl composes the
other trait methods so concrete types don’t need to override.