fn synchronize_overwrite(mut sp: dyn SyncProvider, key: &str, book: &Book, password: &str) -> VResult<()> {
    let data = crate::encrypt(password, book.clone())?;
    match sp.read(key) {
        Ok((_, update_key)) => {
            sp.update(key, data, update_key)?;
            Ok(())
        },
        Err(Error::NoSuchKey(_)) => {
            sp.create(key, data)?;
            Ok(())
        },
        e => {
            e?;
            unreachable!()
        },
    }
}
/// Synchronize vault, overwriting the old value.
Synchronize vault, overwriting the old value.
Synchronize vault overwriting the old value .
fn synchronize_overwrite(mut sp: dyn SyncProvider, key: &str, book: &Book, password: &str) -> VResult<()> {
    let data = crate::encrypt(password, book.clone())?;
    match sp.read(key) {
        Ok((_, update_key)) => {
            sp.update(key, data, update_key)?;
            Ok(())
        },
        Err(Error::NoSuchKey(_)) => {
            sp.create(key, data)?;
            Ok(())
        },
        e => {
            e?;
            unreachable!()
        },
    }
}
fn synchronize_overwrite ( mut sp : dyn SyncProvider , key : & str , book : & Book , password : & str ) -> VResult < ( ) > { let data = crate :: encrypt ( password , book . clone ( ) ) ? ; match sp . read ( key ) { Ok ( ( _ , update_key ) ) => { sp . update ( key , data , update_key ) ? ; Ok ( ( ) ) } , Err ( Error :: NoSuchKey ( _ ) ) => { sp . create ( key , data ) ? ; Ok ( ( ) ) } , e => { e ? ; unreachable ! ( ) } , } }
Synchronize vault, overwriting the old value.
Synchronize vault overwriting the old value .
sp
dyn SyncProvider
key
&str
book
&Book
password
&str
sp
dyn SyncProvider
key
&str
book
&Book
password
&str