Skip to main content

Module host_array

Module host_array 

Source
Expand description

Read-only array allocated in Rust, safe to access from the host language without copying.

This module defines HostArray, a bridge between Rust-owned numeric arrays and the host language (Python, C, Wasm/JS). A HostArray stores a raw data pointer together with shape, strides, and scalar type metadata. It optionally owns the underlying allocation via a Box<dyn Any>, ensuring the data remains valid for as long as the HostArray exists.

HostArray is the return type of SolutionWrapper::get_ys, SolutionWrapper::get_ts, and SolutionWrapper::get_sens.

§Conversion traits

  • ToHostArray — convert owned Rust types (e.g. Vec<T>, nalgebra::DMatrix<T>, faer::Mat<T>) into a HostArray.
  • FromHostArray — convert a HostArray back into a Rust type (e.g. Vec<f64>, Vec<Vec<f64>>, ndarray::ArrayView2).

§Key methods

Structs§

HostArray
a read-only array that is allocated in rust and can be safely accessed in the host language (e.g. Python) without copying

Traits§

FromHostArray
ToHostArray