Struct Dispatcher

Source
pub struct Dispatcher<L> { /* private fields */ }
Expand description

Wrapper of Arc<Lock<T>>

This is used to create Callers for some methods on T:

  • use Dispatcher::listen_ref_N for methods taking &self and N additional parameters
  • use Dispatcher::listen_mut_N for methods taking &mut self and N additional parameters

Deferred calls to these methods can then be scheduled via the returned Callers.

Dispatcher implements Future; You must await this future for calls to actually be dispatched.

Implementations§

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_0<F, R>(&mut self, callback: F) -> Caller<(Instant,)>
where for<'a> F: AsyncFn1<&'a T, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_1<F, R, P1: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1)>
where for<'a> F: AsyncFn2<&'a T, P1, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_2<F, R, P1: Send + 'static, P2: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2)>
where for<'a> F: AsyncFn3<&'a T, P1, P2, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_3<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3)>
where for<'a> F: AsyncFn4<&'a T, P1, P2, P3, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_4<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4)>
where for<'a> F: AsyncFn5<&'a T, P1, P2, P3, P4, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_5<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static, P5: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4, P5)>
where for<'a> F: AsyncFn6<&'a T, P1, P2, P3, P4, P5, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_6<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static, P5: Send + 'static, P6: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4, P5, P6)>
where for<'a> F: AsyncFn7<&'a T, P1, P2, P3, P4, P5, P6, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>

Source

pub fn listen_ref_7<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static, P5: Send + 'static, P6: Send + 'static, P7: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4, P5, P6, P7)>
where for<'a> F: AsyncFn8<&'a T, P1, P2, P3, P4, P5, P6, P7, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_0<F, R>(&mut self, callback: F) -> Caller<(Instant,)>
where for<'a> F: AsyncFn1<&'a mut T, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_1<F, R, P1: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1)>
where for<'a> F: AsyncFn2<&'a mut T, P1, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_2<F, R, P1: Send + 'static, P2: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2)>
where for<'a> F: AsyncFn3<&'a mut T, P1, P2, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_3<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3)>
where for<'a> F: AsyncFn4<&'a mut T, P1, P2, P3, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_4<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4)>
where for<'a> F: AsyncFn5<&'a mut T, P1, P2, P3, P4, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_5<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static, P5: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4, P5)>
where for<'a> F: AsyncFn6<&'a mut T, P1, P2, P3, P4, P5, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_6<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static, P5: Send + 'static, P6: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4, P5, P6)>
where for<'a> F: AsyncFn7<&'a mut T, P1, P2, P3, P4, P5, P6, Output = R>, R: ReturnType,

Source§

impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>

Source

pub fn listen_mut_7<F, R, P1: Send + 'static, P2: Send + 'static, P3: Send + 'static, P4: Send + 'static, P5: Send + 'static, P6: Send + 'static, P7: Send + 'static>( &mut self, callback: F, ) -> Caller<(Instant, P1, P2, P3, P4, P5, P6, P7)>
where for<'a> F: AsyncFn8<&'a mut T, P1, P2, P3, P4, P5, P6, P7, Output = R>, R: ReturnType,

Source§

impl<L> Dispatcher<L>

Source

pub fn new(lock: Arc<L>) -> Self

Trait Implementations§

Source§

impl<L> Future for Dispatcher<L>

Source§

type Output = ()

The type of value produced on completion.
Source§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>

Attempts to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more

Auto Trait Implementations§

§

impl<L> Freeze for Dispatcher<L>

§

impl<L> !RefUnwindSafe for Dispatcher<L>

§

impl<L> Send for Dispatcher<L>
where L: Sync + Send,

§

impl<L> !Sync for Dispatcher<L>

§

impl<L> Unpin for Dispatcher<L>

§

impl<L> !UnwindSafe for Dispatcher<L>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<F> FutureExt for F
where F: Future + ?Sized,

Source§

fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output>
where Self: Unpin,

A convenience for calling Future::poll() on !Unpin types.
Source§

fn or<F>(self, other: F) -> Or<Self, F>
where Self: Sized, F: Future<Output = Self::Output>,

Returns the result of self or other future, preferring self if both are ready. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F> IntoFuture for F
where F: Future,

Source§

type Output = <F as Future>::Output

The output that the future will produce on completion.
Source§

type IntoFuture = F

Which kind of future are we turning this into?
Source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more