pub struct ResetManager<'a, T: SettingsSchema + PartialEq> { /* private fields */ }Expand description
Manager for reset operations with snapshot support.
Implementations§
Source§impl<'a, T: SettingsSchema + PartialEq> ResetManager<'a, T>
impl<'a, T: SettingsSchema + PartialEq> ResetManager<'a, T>
pub fn new(repository: &'a SettingsRepository<T>) -> Self
Sourcepub fn reset_field(&self, name: &str) -> Result<(), SettingsError>
pub fn reset_field(&self, name: &str) -> Result<(), SettingsError>
Reset a single field to its default value.
Sourcepub fn reset_fields(&self, names: &[&str]) -> Result<usize, SettingsError>
pub fn reset_fields(&self, names: &[&str]) -> Result<usize, SettingsError>
Reset multiple fields to their defaults atomically (single persist).
Sourcepub fn reset_category(&self, category: &str) -> Result<usize, SettingsError>
pub fn reset_category(&self, category: &str) -> Result<usize, SettingsError>
Reset all fields in a category.
Sourcepub fn reset_ui_settings(&self) -> Result<usize, SettingsError>
pub fn reset_ui_settings(&self) -> Result<usize, SettingsError>
Reset all UI (non-persisted-only) settings.
Sourcepub fn reset_all(&self) -> Result<(), SettingsError>
pub fn reset_all(&self) -> Result<(), SettingsError>
Reset everything (including persisted-only fields).
Sourcepub fn create_snapshot(&self) -> Result<SettingsSnapshot, SettingsError>
pub fn create_snapshot(&self) -> Result<SettingsSnapshot, SettingsError>
Create a snapshot of current settings for later restoration.
Sourcepub fn restore_snapshot(
&self,
snapshot: &SettingsSnapshot,
) -> Result<(), SettingsError>
pub fn restore_snapshot( &self, snapshot: &SettingsSnapshot, ) -> Result<(), SettingsError>
Restore settings from a snapshot.
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for ResetManager<'a, T>
impl<'a, T> !UnwindSafe for ResetManager<'a, T>
impl<'a, T> Freeze for ResetManager<'a, T>where
&'a SettingsRepository<T>: Freeze,
impl<'a, T> Send for ResetManager<'a, T>where
&'a SettingsRepository<T>: Send,
impl<'a, T> Sync for ResetManager<'a, T>where
&'a SettingsRepository<T>: Sync,
impl<'a, T> Unpin for ResetManager<'a, T>where
&'a SettingsRepository<T>: Unpin,
impl<'a, T> UnsafeUnpin for ResetManager<'a, T>where
&'a SettingsRepository<T>: UnsafeUnpin,
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