/// Restore an account from a previously pickled one.
///
/// # Arguments
///
/// * `pickle` - The pickled version of the Account.
///
/// * `pickle_mode` - The mode that was used to pickle the account, either
///   an
/// unencrypted mode or an encrypted using passphrase.
Restore an account from a previously pickled one.
Restore an account from a previously pickled one .
pub fn from_pickle(
        pickle: PickledAccount,
        pickle_mode: PicklingMode,
    ) -> Result<Self, OlmAccountError> {
        let account = OlmAccount::unpickle(pickle.pickle.0, pickle_mode)?;
        let identity_keys = account.parsed_identity_keys();
        Ok(Self {
            user_id: pickle.user_id.into(),
            device_id: pickle.device_id.into(),
            inner: Arc::new(Mutex::new(account)),
            identity_keys: Arc::new(identity_keys),
            shared: Arc::new(AtomicBool::from(pickle.shared)),
            uploaded_signed_key_count: Arc::new(AtomicU64::new(pickle.uploaded_signed_key_count)),
        })
    }
pub fn from_pickle ( pickle : PickledAccount , pickle_mode : PicklingMode , ) -> Result < Self , OlmAccountError > { let account = OlmAccount :: unpickle ( pickle . pickle . 0 , pickle_mode ) ? ; let identity_keys = account . parsed_identity_keys ( ) ; Ok ( Self { user_id : pickle . user_id . into ( ) , device_id : pickle . device_id . into ( ) , inner : Arc :: new ( Mutex :: new ( account ) ) , identity_keys : Arc :: new ( identity_keys ) , shared : Arc :: new ( AtomicBool :: from ( pickle . shared ) ) , uploaded_signed_key_count : Arc :: new ( AtomicU64 :: new ( pickle . uploaded_signed_key_count ) ) , } ) }
Restore an account from a previously pickled one.
Restore an account from a previously pickled one .
pickle
PickledAccount
pickle_mode
PicklingMode