Trait DbCommands

Source
pub trait DbCommands:
    Default
    + Send
    + Sync {
    type Key: Eq + Hash + Clone + Display + Send + Sync;
    type Value: Clone + Send + Sync;
    type Db: Database;

    // Required methods
    async fn get(
        db_pool: &Pool<Self::Db>,
        key: &Self::Key,
    ) -> Option<Self::Value>;
    async fn put(
        db_pool: &Pool<Self::Db>,
        key: Self::Key,
        value: Self::Value,
    ) -> Result<(), GenericError>;
}

Required Associated Types§

Required Methods§

Source

async fn get(db_pool: &Pool<Self::Db>, key: &Self::Key) -> Option<Self::Value>

Source

async fn put( db_pool: &Pool<Self::Db>, key: Self::Key, value: Self::Value, ) -> Result<(), GenericError>

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.

Implementors§