use matio_rs::{Mat, MatFile, MatIO, MayBeFrom}; use tempfile::NamedTempFile; #[derive(Debug, Default, MatIO, Clone)] struct SMat { a: f64, b: Vec, // s: Nested, } #[derive(Debug, Default, MatIO)] struct Nested { a: f64, b: Vec, } impl<'a> MayBeFrom<&[SMat]> for Mat<'a> { fn maybe_from>(name: S, data: Vec) -> matio_rs::Result where Self: Sized, { todo!() } } fn main() -> anyhow::Result<()> { let n = Nested { a: 1f64, b: vec![2, 3, 4, 5], }; let a = SMat { a: 1f64, b: vec![2, 3, 4, 5], // s: n, }; let aa = vec![a.clone(), a]; let file = NamedTempFile::new().unwrap(); MatFile::save(&file)?.var("aa", aa)?; // let aaa: SMat = MatFile::load(file)?.var("aa")?; // dbg!(aas); Ok(()) }