pub fn save_array<F: ArrayElement>(
path: &Path,
array: &Array<F, IxDyn>,
compression: CompressionType,
) -> Result<(), SerializationError>Expand description
Save an n-dimensional array to a .scirs2 file.
The file is created (or truncated) at path. The element type F is
embedded in the payload so load_array can verify type safety on load.
§Arguments
path— Destination file path.array— The array to serialize.compression— Compression algorithm applied to the payload.
§Errors
Returns SerializationError on I/O failures or if the chosen compression
algorithm is unavailable in this build.
§Example
use scirs2_core::serialization::{save_array, CompressionType};
use ndarray::Array2;
let data = Array2::<f64>::eye(4).into_dyn();
save_array(std::path::Path::new("/tmp/eye4.scirs2"), &data, CompressionType::None).expect("should succeed");