Trait AsyncMutex

Source
pub trait AsyncMutex<DS: Sized> {
    type MutxGuard<'mux>: AsyncMutexGuard<'mux, DS>
       where Self: 'mux;

    // Required methods
    fn a_new(v: DS) -> Self;
    async fn a_lock<'mux>(&'mux self) -> Self::MutxGuard<'mux>;
}
Expand description

A trait which generalize the mutex from the std lib’s of multiple async executors. The trait can be implemented on mutex directly or on a structure with mutex as inner type.

Required Associated Types§

Source

type MutxGuard<'mux>: AsyncMutexGuard<'mux, DS> where Self: 'mux

A mutex guard type.

Required Methods§

Source

fn a_new(v: DS) -> Self

Creates new mutex instance for type which implements the [AsyncSyslogApi].

Source

async fn a_lock<'mux>(&'mux self) -> Self::MutxGuard<'mux>

Locks the mutex emmiting the mutex guard.

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.

Implementations on Foreign Types§

Source§

impl<DS: Sized> AsyncMutex<DS> for Mutex<DS>

Source§

type MutxGuard<'mux> = MutexGuard<'mux, DS> where DS: 'mux

Source§

fn a_new(v: DS) -> Self

Source§

fn a_lock<'mux>(&'mux self) -> impl Future<Output = Self::MutxGuard<'mux>>

Implementors§