Trait GlobalLock

Source
pub trait GlobalLock:
    Send
    + Sync
    + 'static {
    // Required method
    fn with_lock<'life0, 'life1, 'async_trait, R, F, Fut>(
        &'life0 self,
        name: &'life1 str,
        timeout: Duration,
        op: F,
    ) -> Pin<Box<dyn Future<Output = Result<R, LockError>> + Send + 'async_trait>>
       where F: FnOnce() -> Fut + Send + 'static + 'async_trait,
             Fut: Future<Output = R> + Send + 'static + 'async_trait,
             R: Send + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Back‑end agnostic trait. On wasm32 the Send bounds are automatically relaxed (?Send).

Required Methods§

Source

fn with_lock<'life0, 'life1, 'async_trait, R, F, Fut>( &'life0 self, name: &'life1 str, timeout: Duration, op: F, ) -> Pin<Box<dyn Future<Output = Result<R, LockError>> + Send + 'async_trait>>
where F: FnOnce() -> Fut + Send + 'static + 'async_trait, Fut: Future<Output = R> + Send + 'static + 'async_trait, R: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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<T: GlobalLock> GlobalLock for Arc<T>

Source§

fn with_lock<'life0, 'life1, 'async_trait, R, F, Fut>( &'life0 self, n: &'life1 str, t: Duration, f: F, ) -> Pin<Box<dyn Future<Output = Result<R, LockError>> + Send + 'async_trait>>
where F: FnOnce() -> Fut + Send + 'static + 'async_trait, Fut: Future<Output = R> + Send + 'static + 'async_trait, R: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§