Trait blockz::singleton::Singleton[][src]

pub trait Singleton {
    type Inner;
    fn init_singleton(inner: Self::Inner) -> Result<()>;
#[must_use] fn use_singleton<'async_trait, F, R>(
        clojure: F
    ) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>>
    where
        F: for<'c> SingletonFn<'c, Self::Inner, R> + Send,
        R: Send,
        F: 'async_trait,
        R: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn use_singleton_with_arg<'async_trait, F, A, R>(
        clojure: F,
        arg: A
    ) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>>
    where
        F: for<'c> SingletonFnWithArg<'c, Self::Inner, A, R> + Send,
        A: Send,
        R: Send,
        F: 'async_trait,
        A: 'async_trait,
        R: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn use_mut_singleton<'async_trait, F, R>(
        clojure: F
    ) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>>
    where
        F: for<'c> SingletonFnMut<'c, Self::Inner, R> + Send,
        R: Send,
        F: 'async_trait,
        R: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn use_mut_singleton_with_arg<'async_trait, F, A, R>(
        clojure: F,
        arg: A
    ) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>>
    where
        F: for<'c> SingletonFnMutWithArg<'c, Self::Inner, A, R> + Send,
        A: Send,
        R: Send,
        F: 'async_trait,
        A: 'async_trait,
        R: 'async_trait,
        Self: 'async_trait
; }
This is supported on crate feature singleton only.

A singleton.

Associated Types

type Inner[src]

Inner value contained by the singleton.

Loading content...

Required methods

fn init_singleton(inner: Self::Inner) -> Result<()>[src]

Initialize the singleton.

This can fail if the singleton has already been initialized.

#[must_use]fn use_singleton<'async_trait, F, R>(
    clojure: F
) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>> where
    F: for<'c> SingletonFn<'c, Self::Inner, R> + Send,
    R: Send,
    F: 'async_trait,
    R: 'async_trait,
    Self: 'async_trait, 
[src]

Use the singleton with an immutable reference.

#[must_use]fn use_singleton_with_arg<'async_trait, F, A, R>(
    clojure: F,
    arg: A
) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>> where
    F: for<'c> SingletonFnWithArg<'c, Self::Inner, A, R> + Send,
    A: Send,
    R: Send,
    F: 'async_trait,
    A: 'async_trait,
    R: 'async_trait,
    Self: 'async_trait, 
[src]

Use the singleton with an immutable reference and an argument.

#[must_use]fn use_mut_singleton<'async_trait, F, R>(
    clojure: F
) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>> where
    F: for<'c> SingletonFnMut<'c, Self::Inner, R> + Send,
    R: Send,
    F: 'async_trait,
    R: 'async_trait,
    Self: 'async_trait, 
[src]

Use the singleton with a mutable reference.

#[must_use]fn use_mut_singleton_with_arg<'async_trait, F, A, R>(
    clojure: F,
    arg: A
) -> Pin<Box<dyn Future<Output = R> + Send + 'async_trait>> where
    F: for<'c> SingletonFnMutWithArg<'c, Self::Inner, A, R> + Send,
    A: Send,
    R: Send,
    F: 'async_trait,
    A: 'async_trait,
    R: 'async_trait,
    Self: 'async_trait, 
[src]

Use the singleton with an immutable reference and an argument.

Loading content...

Implementors

Loading content...