pub struct Dispatcher<L> { /* private fields */ }
Expand description
Wrapper of Arc<Lock<T>>
This is used to create Caller
s 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 Caller
s.
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
Source§impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockRef<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
Source§impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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>
impl<T: Send, L: LockMut<Inner = T>> Dispatcher<L>
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,
Trait Implementations§
Source§impl<L> Future for Dispatcher<L>
impl<L> Future for Dispatcher<L>
Auto Trait Implementations§
impl<L> Freeze for Dispatcher<L>
impl<L> !RefUnwindSafe for Dispatcher<L>
impl<L> Send for Dispatcher<L>
impl<L> !Sync for Dispatcher<L>
impl<L> Unpin for Dispatcher<L>
impl<L> !UnwindSafe for Dispatcher<L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<F> FutureExt for F
impl<F> FutureExt for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more