pub struct SettingsBackupManager { /* private fields */ }Expand description
Manages backup/restore operations.
Implementations§
Source§impl SettingsBackupManager
impl SettingsBackupManager
pub fn new(app_id: impl Into<String>, schema_version: u32) -> Self
Sourcepub fn with_device_info(
self,
provider: impl Fn() -> DeviceInfo + Send + Sync + 'static,
) -> Self
pub fn with_device_info( self, provider: impl Fn() -> DeviceInfo + Send + Sync + 'static, ) -> Self
Set a provider for device info included in backups.
Sourcepub fn export<T: SettingsSchema>(
&self,
settings: &T,
) -> Result<String, SettingsError>
pub fn export<T: SettingsSchema>( &self, settings: &T, ) -> Result<String, SettingsError>
Export settings to a JSON string.
Sourcepub fn import<T: SettingsSchema>(
&self,
json_str: &str,
options: &ImportOptions,
) -> Result<T, SettingsError>
pub fn import<T: SettingsSchema>( &self, json_str: &str, options: &ImportOptions, ) -> Result<T, SettingsError>
Import settings from a JSON string.
Sourcepub fn validate(&self, json_str: &str) -> BackupValidationResult
pub fn validate(&self, json_str: &str) -> BackupValidationResult
Validate a backup without importing.
Auto Trait Implementations§
impl !RefUnwindSafe for SettingsBackupManager
impl !UnwindSafe for SettingsBackupManager
impl Freeze for SettingsBackupManager
impl Send for SettingsBackupManager
impl Sync for SettingsBackupManager
impl Unpin for SettingsBackupManager
impl UnsafeUnpin for SettingsBackupManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more