pub(in crate) fn serialize_to_snapshot(snapshot: &PathBuf, pass: &str, client: Client<Provider>) {
    let mut file = OpenOptions::new()
        .write(true)
        .create(true)
        .open(snapshot)
        .expect("Unable to access snapshot. Make sure that it exists or run encrypt to build a new one.");

    // clear contents of the file before writing.
    file.set_len(0).expect("unable to clear the contents of the file file");

    let snap: Snapshot<Provider> = Snapshot::new(client.id, client.db.key);

    let data: Vec<u8> = bincode::serialize(&snap).expect("Couldn't serialize the client data");
    encrypt_snapshot(data, &mut file, pass.as_bytes()).expect("Couldn't write to the snapshot");
}
// serialize the snapshot data into the snapshot file.
serialize the snapshot data into the snapshot file.
serialize the snapshot data into the snapshot file .
pub(in crate) fn serialize_to_snapshot(snapshot: &PathBuf, pass: &str, client: Client<Provider>) {
    let mut file = OpenOptions::new()
        .write(true)
        .create(true)
        .open(snapshot)
        .expect("Unable to access snapshot. Make sure that it exists or run encrypt to build a new one.");
    // clear contents of the file before writing.
    file.set_len(0).expect("unable to clear the contents of the file file");
    let snap: Snapshot<Provider> = Snapshot::new(client.id, client.db.key);
    let data: Vec<u8> = bincode::serialize(&snap).expect("Couldn't serialize the client data");
    encrypt_snapshot(data, &mut file, pass.as_bytes()).expect("Couldn't write to the snapshot");
}
pub ( in crate ) fn serialize_to_snapshot ( snapshot : & PathBuf , pass : & str , client : Client < Provider > ) { let mut file = OpenOptions :: new ( ) . write ( true ) . create ( true ) . open ( snapshot ) . expect ( " " ) ; // clear contents of the file before writing. file . set_len ( 0 ) . expect ( " " ) ; let snap : Snapshot < Provider > = Snapshot :: new ( client . id , client . db . key ) ; let data : Vec < u8 > = bincode :: serialize ( & snap ) . expect ( " " ) ; encrypt_snapshot ( data , & mut file , pass . as_bytes ( ) ) . expect ( " " ) ; }
serialize the snapshot data into the snapshot file.
serialize the snapshot data into the snapshot file .
snapshot
&PathBuf
pass
&str
client
Client<Provider>