pub struct FidlStorage { /* private fields */ }
Expand description
Stores device level settings in persistent storage. User level settings should not use this.
Implementations§
Source§impl FidlStorage
impl FidlStorage
Sourcepub async fn with_file_proxy<I, G>(
iter: I,
storage_dir: DirectoryProxy,
files_generator: G,
) -> Result<(Self, Vec<Task<()>>), Error>
pub async fn with_file_proxy<I, G>( iter: I, storage_dir: DirectoryProxy, files_generator: G, ) -> Result<(Self, Vec<Task<()>>), Error>
Construct a fidl storage from:
- The iterable item, which will produce the keys for storage
- A generator function that will produce a file proxy for each key. It will return the temp file path and final file path for storing the data for this key.
On success, returns the FidlStorage as well as the list of background synchronizing tasks. The background tasks can be awaited or detached.
pub fn set_caching_enabled(&mut self, enabled: bool)
pub fn set_debounce_writes(&mut self, debounce: bool)
Sourcepub async fn write<T>(&self, new_value: T) -> Result<UpdateState, Error>
pub async fn write<T>(&self, new_value: T) -> Result<UpdateState, Error>
Write new_value
to storage. The write will be persisted to disk at a set interval.
Sourcepub async fn write_test_bytes(
&self,
key: &'static str,
value: Vec<u8>,
) -> Result<(), Error>
pub async fn write_test_bytes( &self, key: &'static str, value: Vec<u8>, ) -> Result<(), Error>
Test-only method to write directly to disk without touching the cache. This is used for setting up data as if it existed on disk before the storage was constructed.
Auto Trait Implementations§
impl Freeze for FidlStorage
impl !RefUnwindSafe for FidlStorage
impl !Send for FidlStorage
impl !Sync for FidlStorage
impl Unpin for FidlStorage
impl !UnwindSafe for FidlStorage
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,
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