pub trait UnifiedUniqueEntityExt: UnifiedUniqueEntity + UnifiedEntityDatabaseMutation {
// Required methods
fn get_unique(conn: &Connection) -> CryptoKeystoreResult<Option<Self>>;
fn set_and_replace(
&self,
tx: &Transaction<'_>,
) -> CryptoKeystoreResult<bool>;
fn set_if_absent(&self, tx: &Transaction<'_>) -> CryptoKeystoreResult<bool>;
fn exists(conn: &Connection) -> CryptoKeystoreResult<bool>;
}Expand description
Unique entities get some convenience methods implemented automatically.
Required Methods§
Sourcefn get_unique(conn: &Connection) -> CryptoKeystoreResult<Option<Self>>
fn get_unique(conn: &Connection) -> CryptoKeystoreResult<Option<Self>>
Get this unique entity from the database.
Sourcefn set_and_replace(&self, tx: &Transaction<'_>) -> CryptoKeystoreResult<bool>
fn set_and_replace(&self, tx: &Transaction<'_>) -> CryptoKeystoreResult<bool>
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(&self, tx: &Transaction<'_>) -> CryptoKeystoreResult<bool>
fn set_if_absent(&self, tx: &Transaction<'_>) -> CryptoKeystoreResult<bool>
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(conn: &Connection) -> CryptoKeystoreResult<bool>
fn exists(conn: &Connection) -> CryptoKeystoreResult<bool>
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.