Skip to main content

UniqueArc

Struct UniqueArc 

Source
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>

Source

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>

Source

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.

Source

pub fn downgrade(this: &Self) -> UniqueWeak<T>

Produce a weak reference to this item

Trait Implementations§

Source§

impl<T: Debug> Debug for UniqueArc<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for UniqueArc<T>
where Arc<T>: Deref,

Source§

type Target = <Arc<T> as Deref>::Target

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> FetchFromDatabase for UniqueArc<T>

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>>
where E: 'static + Entity + Clone + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: '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>>
where E: 'static + Entity + Clone + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: '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>>
where E: 'static + Entity + Clone + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: '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,

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,

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,

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>>
where E: 'static + Entity + SearchableEntity<SearchKey> + Clone + Send + Sync + 'async_trait, SearchKey: KeyType + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Search for relevant instances of E given a search key.

Source§

impl<T> From<T> for UniqueArc<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for UniqueArc<T>

§

impl<T> !RefUnwindSafe for UniqueArc<T>

§

impl<T> Send for UniqueArc<T>
where T: Sync + Send,

§

impl<T> Sync for UniqueArc<T>
where T: Sync + Send,

§

impl<T> Unpin for UniqueArc<T>

§

impl<T> UnsafeUnpin for UniqueArc<T>

§

impl<T> !UnwindSafe for UniqueArc<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Formattable for T
where T: Deref, <T as Deref>::Target: Formattable,

§

impl<T> MaybeSendSync for T

§

impl<T> Parsable for T
where T: Deref, <T as Deref>::Target: Parsable,