Skip to main content

save_to_disk

Function save_to_disk 

Source
pub fn save_to_disk<T>(
    x: &T,
    dir: impl AsRef<Path>,
    metadata: impl AsRef<Path>,
) -> Result<()>
where T: Saveable,
Expand description

Serialize x to disk.

The manifest (a JSON document) is written atomically to metadata; any side-car artifacts the type’s Save::save impl creates via Context::write are written into dir.

§Errors

Returns Error if the directory cannot be written to, if the manifest cannot be serialized, or if a user impl returns an error.