pub trait UniqueEntityExt<'a>: UniqueEntity + EntityDatabaseMutation<'a> {
// Required methods
fn get_unique<'life0, 'async_trait>(
conn: &'life0 mut Self::ConnectionType,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<Self>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_and_replace<'life0, 'async_trait>(
&'a self,
tx: &'life0 Self::Transaction,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait;
fn set_if_absent<'life0, 'async_trait>(
&'a self,
tx: &'life0 Self::Transaction,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait;
fn exists<'life0, 'async_trait>(
conn: &'life0 mut Self::ConnectionType,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Unique entities get some convenience methods implemented automatically.
Required Methods§
Sourcefn get_unique<'life0, 'async_trait>(
conn: &'life0 mut Self::ConnectionType,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<Self>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_unique<'life0, 'async_trait>(
conn: &'life0 mut Self::ConnectionType,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<Self>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get this unique entity from the database.
Sourcefn set_and_replace<'life0, 'async_trait>(
&'a self,
tx: &'life0 Self::Transaction,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn set_and_replace<'life0, 'async_trait>(
&'a self,
tx: &'life0 Self::Transaction,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Set this unique entity into the database, replacing it if it already exists.
Returns true if the entity previously existed and was replaced, or
false if it was not removed and this was a pure insertion.
Sourcefn set_if_absent<'life0, 'async_trait>(
&'a self,
tx: &'life0 Self::Transaction,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn set_if_absent<'life0, 'async_trait>(
&'a self,
tx: &'life0 Self::Transaction,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Set this unique entity into the database if it does not already exist.
Returns true if the entity was saved, or false if it aborted due to an already-existing entity.
Sourcefn exists<'life0, 'async_trait>(
conn: &'life0 mut Self::ConnectionType,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exists<'life0, 'async_trait>(
conn: &'life0 mut Self::ConnectionType,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns whether or not the database contains an instance of this unique entity.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.