pub struct InMemoryStorageFactory { /* private fields */ }Expand description
Storage that does not write to disk, for testing.
Implementations§
Source§impl InMemoryStorageFactory
impl InMemoryStorageFactory
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new InMemoryStorageFactory with the ability to create a DeviceStorage
that can only read and write to the storage keys passed in.
Sourcepub fn with_initial_data<T>(data: &T) -> Selfwhere
T: DeviceStorageCompatible,
pub fn with_initial_data<T>(data: &T) -> Selfwhere
T: DeviceStorageCompatible,
Constructs a new InMemoryStorageFactory with the data written to stash. This simulates
the data existing in storage before the RestoreAgent reads it.
Sourcepub async fn initialize_storage<T>(&self)where
T: DeviceStorageCompatible,
pub async fn initialize_storage<T>(&self)where
T: DeviceStorageCompatible,
Helper method to simplify setup for InMemoryStorageFactory in tests.
Sourcepub async fn get_device_storage(&self) -> Rc<DeviceStorage>
pub async fn get_device_storage(&self) -> Rc<DeviceStorage>
Retrieve the DeviceStorage singleton.
Trait Implementations§
Source§impl Default for InMemoryStorageFactory
impl Default for InMemoryStorageFactory
Source§impl StorageFactory for InMemoryStorageFactory
impl StorageFactory for InMemoryStorageFactory
Source§type Storage = DeviceStorage
type Storage = DeviceStorage
The storage type used to manage persisted data.
Source§async fn initialize<T>(&self) -> Result<(), Error>where
T: StorageAccess<Storage = DeviceStorage>,
async fn initialize<T>(&self) -> Result<(), Error>where
T: StorageAccess<Storage = DeviceStorage>,
Initialize the storage to be able to manage storage for objects of type T.
This will return an Error once
get_store is called the first time.Source§async fn initialize_with_loader<T, L>(&self, loader: L) -> Result<(), Error>
async fn initialize_with_loader<T, L>(&self, loader: L) -> Result<(), Error>
Initialize the storage to be able to manage storage for objects of type T.
This will return an Error once
get_store is called the first time.Source§async fn get_store(&self) -> Rc<DeviceStorage>
async fn get_store(&self) -> Rc<DeviceStorage>
Retrieve the store singleton instance.
Auto Trait Implementations§
impl !Freeze for InMemoryStorageFactory
impl !RefUnwindSafe for InMemoryStorageFactory
impl !Send for InMemoryStorageFactory
impl !Sync for InMemoryStorageFactory
impl Unpin for InMemoryStorageFactory
impl UnsafeUnpin for InMemoryStorageFactory
impl !UnwindSafe for InMemoryStorageFactory
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more