Trait AsyncMutex

Source
pub trait AsyncMutex<F: SyslogFormatter, D: AsyncSyslogDestination, DS: AsyncSyslogApi<F, D>> {
    type MutxGuard<'mux>: AsyncMutexGuard<'mux, F, D, 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 should be implemented on the mutex direclty.

Required Associated Types§

Source

type MutxGuard<'mux>: AsyncMutexGuard<'mux, F, D, 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<F: SyslogFormatter + Send, D: AsyncSyslogDestination, IO: AsyncSyslogInternalIO> AsyncMutex<F, D, AsyncSyslogInternal<F, D, IO>> for Mutex<AsyncSyslogInternal<F, D, IO>>

Source§

type MutxGuard<'mux> = MutexGuard<'mux, AsyncSyslogInternal<F, D, IO>>

Source§

fn a_new(v: AsyncSyslogInternal<F, D, IO>) -> Self

Source§

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

Implementors§