pub async fn interact<F, R>(&self, f: F) -> Result<R, InteractError<E>>
    where
        F: FnOnce(&mut T) -> Result<R, E> + Send + 'static,
        R: Send + 'static,
    {
        let arc = self.obj.clone();
        self.runtime
            .spawn_blocking(move || {
                let mut guard = arc.lock().unwrap();
                let conn = guard.as_mut().unwrap();
                f(conn)
            })
            .await
            .map_err(|e| match e {
                SpawnBlockingError::Panic(p) => InteractError::Panic(p),
            })?
            .map_err(InteractError::Backend)
    }
/// Interacts with the underlying object.
///
/// Expects a closure that takes the object as its parameter.
/// The closure is executed in a separate thread so that the async runtime
/// is not blocked.
Interacts with the underlying object.
Expects a closure that takes the object as its parameter.
The closure is executed in a separate thread so that the async runtime
is not blocked.
Interacts with the underlying object . Expects a closure that takes the object as its parameter . The closure is executed in a separate thread so that the async runtime is not blocked .
pub async fn interact<F, R>(&self, f: F) -> Result<R, InteractError<E>>
    where
        F: FnOnce(&mut T) -> Result<R, E> + Send + 'static,
        R: Send + 'static,
    {
        let arc = self.obj.clone();
        self.runtime
            .spawn_blocking(move || {
                let mut guard = arc.lock().unwrap();
                let conn = guard.as_mut().unwrap();
                f(conn)
            })
            .await
            .map_err(|e| match e {
                SpawnBlockingError::Panic(p) => InteractError::Panic(p),
            })?
            .map_err(InteractError::Backend)
    }
pub async fn interact < F , R > ( & self , f : F ) -> Result < R , InteractError < E > > where F : FnOnce ( & mut T ) -> Result < R , E > + Send + ' static , R : Send + ' static , { let arc = self . obj . clone ( ) ; self . runtime . spawn_blocking ( move | | { let mut guard = arc . lock ( ) . unwrap ( ) ; let conn = guard . as_mut ( ) . unwrap ( ) ; f ( conn ) } ) . await . map_err ( | e | match e { SpawnBlockingError :: Panic ( p ) => InteractError :: Panic ( p ) , } ) ? . map_err ( InteractError :: Backend ) }
Interacts with the underlying object.
Interacts with the underlying object .
&self
f
F
&self
f
F