/// Write a copy of all of the files saved in the RamDirectory in the target `Directory`.
///
/// Files are all written using the `Directory::write` meaning, even if they were
/// written using the `atomic_write` api.
///
/// If an error is encounterred, files may be persisted partially.
Write a copy of all of the files saved in the RamDirectory in the target `Directory`.
Files are all written using the `Directory::write` meaning, even if they were
written using the `atomic_write` api.

If an error is encounterred, files may be persisted partially.
Write a copy of all of the files saved in the RamDirectory in the target ` Directory ` . Files are all written using the ` Directory :: write ` meaning even if they were written using the ` atomic_write ` api . If an error is encounterred files may be persisted partially .
pub fn persist(&self, dest: &dyn Directory) -> crate::Result<()> {
        let wlock = self.fs.write().unwrap();
        for (path, file) in wlock.fs.iter() {
            let mut dest_wrt = dest.open_write(path)?;
            dest_wrt.write_all(file.read_bytes()?.as_slice())?;
            dest_wrt.terminate()?;
        }
        Ok(())
    }
pub fn persist ( & self , dest : & dyn Directory ) -> crate :: Result < ( ) > { let wlock = self . fs . write ( ) . unwrap ( ) ; for ( path , file ) in wlock . fs . iter ( ) { let mut dest_wrt = dest . open_write ( path ) ? ; dest_wrt . write_all ( file . read_bytes ( ) ? . as_slice ( ) ) ? ; dest_wrt . terminate ( ) ? ; } Ok ( ( ) ) }
Write a copy of all of the files saved in the RamDirectory in the target `Directory`.
Write a copy of all of the files saved in the RamDirectory in the target ` Directory ` .
&self
dest
&dyn Directory