pub fn write_to_snapshot(&self, name: Option<&str>, path: Option<&Path>, key: Key) -> crate::Result<()> {
        let data = self.state.serialize();

        // TODO: This is a hack and probably should be removed when we add proper error handling.
        let f = move || {
            match path {
                Some(p) => write_to(&data, p, &key, &[])?,
                None => write_to(&data, &snapshot::files::get_path(name)?, &key, &[])?,
            }
            Ok(())
        };
        match f() {
            Ok(()) => Ok(()),
            Err(_) => f(),
        }
    }
/// Writes state to the specified named snapshot or the specified path
/// TODO: Add associated data.
Writes state to the specified named snapshot or the specified path
TODO: Add associated data.
Writes state to the specified named snapshot or the specified path TODO : Add associated data .
pub fn write_to_snapshot(&self, name: Option<&str>, path: Option<&Path>, key: Key) -> crate::Result<()> {
        let data = self.state.serialize();
        // TODO: This is a hack and probably should be removed when we add proper error handling.
        let f = move || {
            match path {
                Some(p) => write_to(&data, p, &key, &[])?,
                None => write_to(&data, &snapshot::files::get_path(name)?, &key, &[])?,
            }
            Ok(())
        };
        match f() {
            Ok(()) => Ok(()),
            Err(_) => f(),
        }
    }
pub fn write_to_snapshot ( & self , name : Option < & str > , path : Option < & Path > , key : Key ) -> crate :: Result < ( ) > { let data = self . state . serialize ( ) ; // TODO: This is a hack and probably should be removed when we add proper error handling. let f = move | | { match path { Some ( p ) => write_to ( & data , p , & key , & [ ] ) ? , None => write_to ( & data , & snapshot :: files :: get_path ( name ) ? , & key , & [ ] ) ? , } Ok ( ( ) ) } ; match f ( ) { Ok ( ( ) ) => Ok ( ( ) ) , Err ( _ ) => f ( ) , } }
Writes state to the specified named snapshot or the specified path
TODO: Add associated data.
Writes state to the specified named snapshot or the specified path TODO : Add associated data .
&self
name
Option<&str>
path
Option<&Path>
key
Key
&self
name
Option<&str>
path
Option<&Path>
key
Key