pub struct IndexedDbStorage { /* private fields */ }
Expand description
IndexedDB storage implementation (currently falls back to localStorage)
Implementations§
Source§impl IndexedDbStorage
impl IndexedDbStorage
Sourcepub async fn create_database(&self) -> Result<(), StorageError>
pub async fn create_database(&self) -> Result<(), StorageError>
Create an IndexedDB database
Sourcepub async fn open_database(&self) -> Result<(), StorageError>
pub async fn open_database(&self) -> Result<(), StorageError>
Open an IndexedDB database
Sourcepub async fn create_object_store(&self) -> Result<(), StorageError>
pub async fn create_object_store(&self) -> Result<(), StorageError>
Create an object store
Sourcepub async fn indexeddb_get<T: DeserializeOwned>(
&self,
_key: &str,
) -> Result<Option<T>, StorageError>
pub async fn indexeddb_get<T: DeserializeOwned>( &self, _key: &str, ) -> Result<Option<T>, StorageError>
Get a value from IndexedDB
Sourcepub async fn indexeddb_set<T: Serialize>(
&self,
_key: &str,
_value: &T,
) -> Result<(), StorageError>
pub async fn indexeddb_set<T: Serialize>( &self, _key: &str, _value: &T, ) -> Result<(), StorageError>
Set a value in IndexedDB
Sourcepub async fn indexeddb_delete(&self, _key: &str) -> Result<(), StorageError>
pub async fn indexeddb_delete(&self, _key: &str) -> Result<(), StorageError>
Delete a value from IndexedDB
Sourcepub async fn indexeddb_keys(&self) -> Result<Vec<String>, StorageError>
pub async fn indexeddb_keys(&self) -> Result<Vec<String>, StorageError>
Get all keys from IndexedDB
Trait Implementations§
Source§impl Clone for IndexedDbStorage
impl Clone for IndexedDbStorage
Source§impl LocalStorage for IndexedDbStorage
impl LocalStorage for IndexedDbStorage
Source§fn set<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
key: &'life1 str,
value: &'life2 T,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
fn set<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, key: &'life1 str, value: &'life2 T, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
Store a value with the given key
Source§fn get<'life0, 'life1, 'async_trait, T>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, StorageError>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait, T>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, StorageError>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a value by key
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a value by key
Source§fn keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all keys
Source§fn contains_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contains_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a key exists
Source§fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the number of stored items
Auto Trait Implementations§
impl Freeze for IndexedDbStorage
impl !RefUnwindSafe for IndexedDbStorage
impl Send for IndexedDbStorage
impl Sync for IndexedDbStorage
impl Unpin for IndexedDbStorage
impl !UnwindSafe for IndexedDbStorage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.