async fn db_op_async<R, F>(&self, f: F) -> Result<R, CacheError>
    where
        R: Send + 'static,
        F: FnOnce(&MultiDB) -> Result<R, CacheError> + Send + 'static,
    {
        let db = Arc::clone(&self.db);

        // spawn the tokio task that will call the function to perform the async db operation
        tokio::task::spawn_blocking(move || f(&db))
            .await
            .map_err(CacheError::TokioJoin)
            .and_then(|x| x)
    }
/// Function that will spawn a blocking threat to perform an async db operation.
Function that will spawn a blocking threat to perform an async db operation.
Function that will spawn a blocking threat to perform an async db operation .
async fn db_op_async<R, F>(&self, f: F) -> Result<R, CacheError>
    where
        R: Send + 'static,
        F: FnOnce(&MultiDB) -> Result<R, CacheError> + Send + 'static,
    {
        let db = Arc::clone(&self.db);
        // spawn the tokio task that will call the function to perform the async db operation
        tokio::task::spawn_blocking(move || f(&db))
            .await
            .map_err(CacheError::TokioJoin)
            .and_then(|x| x)
    }
async fn db_op_async < R , F > ( & self , f : F ) -> Result < R , CacheError > where R : Send + ' static , F : FnOnce ( & MultiDB ) -> Result < R , CacheError > + Send + ' static , { let db = Arc :: clone ( & self . db ) ; // spawn the tokio task that will call the function to perform the async db operation tokio :: task :: spawn_blocking ( move | | f ( & db ) ) . await . map_err ( CacheError :: TokioJoin ) . and_then ( | x | x ) }
Function that will spawn a blocking threat to perform an async db operation.
Function that will spawn a blocking threat to perform an async db operation .
&self
f
F