Skip to main content

NumericArrayRead

Trait NumericArrayRead 

Source
pub trait NumericArrayRead {
    // Required methods
    fn data_type(&self) -> NumericArrayEnum;
    fn dimensions(&self) -> &[usize];

    // Provided methods
    fn rank(&self) -> usize { ... }
    fn element_count(&self) -> usize { ... }
    fn try_as_slice<T: ArrayElement<NumericArrayEnum>>(&self) -> Option<&[T]> { ... }
}
Expand description

Common read API implemented by both the owned crate::NumericArray / crate::PackedArray and the runtime-handle NumericArray<T> in wolfram-library-link.

Required Methods§

Source

fn data_type(&self) -> NumericArrayEnum

The element-type tag.

Source

fn dimensions(&self) -> &[usize]

The multi-dimensional shape (row-major).

Provided Methods§

Source

fn rank(&self) -> usize

Number of dimensions.

Source

fn element_count(&self) -> usize

Total element count = product of dimensions.

Source

fn try_as_slice<T: ArrayElement<NumericArrayEnum>>(&self) -> Option<&[T]>

View the buffer as &[T] if T’s element type matches; else None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§