pub struct UniqueArc<T> { /* private fields */ }Expand description
A smart pointer which has exactly one strong reference to the inner type, but may have several weak references.
This type is intentionally !Clone so that we know for a fact that it can be
safely unpacked.
Implementations§
Source§impl UniqueArc<Transaction>
impl UniqueArc<Transaction>
Sourcepub async fn commit(self) -> Result<(), CryptoKeystoreError>
pub async fn commit(self) -> Result<(), CryptoKeystoreError>
Persists all the operations in the database. It will effectively open a transaction internally, perform all the buffered operations and commit.
Source§impl<T> UniqueArc<T>
impl<T> UniqueArc<T>
Sourcepub async fn into_inner(this: Self) -> T
pub async fn into_inner(this: Self) -> T
Unpack this UniqueArc, returning the inner value.
This waits for any in-flight UniqueWeak::upgrade / UniqueWeak::upgrade_sync
guard to drop before unpacking, so that the sole remaining strong reference is the one
held by this UniqueArc.
Trait Implementations§
Source§impl<T> FetchFromDatabase for UniqueArc<T>where
T: FetchFromDatabase,
impl<T> FetchFromDatabase for UniqueArc<T>where
T: FetchFromDatabase,
Source§fn get<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 E::PrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>
fn get<'life0, 'life1, 'async_trait, E>( &'life0 self, id: &'life1 E::PrimaryKey, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>
Get an instance of E from the database by its primary key.
Source§fn count<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>
fn count<'life0, 'async_trait, E>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>
Count the number of Es in the database.
Source§fn load_all<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>
fn load_all<'life0, 'async_trait, E>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>
Load all Es from the database.
Source§fn get_borrowed<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 <E as BorrowPrimaryKey>::BorrowedPrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>where
E: 'static + EntityGetBorrowed + Clone + Send + Sync + 'async_trait,
E::PrimaryKey: Borrow<E::BorrowedPrimaryKey>,
for<'a> &'a E::BorrowedPrimaryKey: KeyType,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_borrowed<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 <E as BorrowPrimaryKey>::BorrowedPrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>where
E: 'static + EntityGetBorrowed + Clone + Send + Sync + 'async_trait,
E::PrimaryKey: Borrow<E::BorrowedPrimaryKey>,
for<'a> &'a E::BorrowedPrimaryKey: KeyType,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an instance of E from the database by the borrowed form of its primary key.
Source§fn get_unique<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<U>>> + Send + 'async_trait>>where
U: 'static + UniqueEntityExt + Entity + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn get_unique<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<U>>> + Send + 'async_trait>>where
U: 'static + UniqueEntityExt + Entity + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Get the requested unique entity from the database.
Source§fn exists<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
U: 'static + UniqueEntityExt + Entity + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn exists<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
U: 'static + UniqueEntityExt + Entity + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Determine whether a unique entity is present in the database.
Source§fn search<'life0, 'life1, 'async_trait, E, SearchKey>(
&'life0 self,
search_key: &'life1 SearchKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>
fn search<'life0, 'life1, 'async_trait, E, SearchKey>( &'life0 self, search_key: &'life1 SearchKey, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>
Search for relevant instances of E given a search key.
Auto Trait Implementations§
impl<T> Freeze for UniqueArc<T>
impl<T> !RefUnwindSafe for UniqueArc<T>
impl<T> Send for UniqueArc<T>
impl<T> Sync for UniqueArc<T>
impl<T> Unpin for UniqueArc<T>
impl<T> UnsafeUnpin for UniqueArc<T>
impl<T> !UnwindSafe for UniqueArc<T>
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
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>
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>
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