pub enum RestoreResult<S> {
Direct(S),
Migrated {
state: S,
from_version: u32,
},
DefaultFallback {
error: MigrationError,
default: S,
},
}Expand description
Result of attempting state restoration with migration.
Variants§
Direct(S)
State was restored directly (versions matched).
Migrated
State was successfully migrated from an older version.
DefaultFallback
Migration failed; falling back to default state.
Implementations§
Source§impl<S> RestoreResult<S>
impl<S> RestoreResult<S>
Sourcepub fn into_state(self) -> S
pub fn into_state(self) -> S
Extract the state value, regardless of how it was obtained.
Sourcepub fn was_migrated(&self) -> bool
pub fn was_migrated(&self) -> bool
Returns true if the state was migrated.
Sourcepub fn is_fallback(&self) -> bool
pub fn is_fallback(&self) -> bool
Returns true if we fell back to default.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for RestoreResult<S>where
S: Freeze,
impl<S> RefUnwindSafe for RestoreResult<S>where
S: RefUnwindSafe,
impl<S> Send for RestoreResult<S>where
S: Send,
impl<S> Sync for RestoreResult<S>where
S: Sync,
impl<S> Unpin for RestoreResult<S>where
S: Unpin,
impl<S> UnsafeUnpin for RestoreResult<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for RestoreResult<S>where
S: UnwindSafe,
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