Skip to content

Commit

Permalink
add saving and loading of lists
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlend committed Jun 11, 2024
1 parent a050cff commit 44f86da
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/neospy/rust/covariance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,24 @@ impl Covariance {
pub fn py_load(filename: String) -> PyResult<Self> {
Ok(Self::load(filename)?)
}

/// Save a list to a binary file.
///
/// Note that this saves a list of Covariances.
#[staticmethod]
#[pyo3(name = "save_list")]
pub fn py_save_list(vec: Vec<Self>, filename: String) -> PyResult<()> {
Ok(Self::save_vec(
&vec, filename,
)?)
}

/// Load a list from a binary file.
///
/// Note that this loads a list of Covariances.
#[staticmethod]
#[pyo3(name = "load_list")]
pub fn py_load_list(filename: String) -> PyResult<Vec<Self>> {
Ok(Self::load_vec(filename)?)
}
}

0 comments on commit 44f86da

Please sign in to comment.