pub struct ApiCallback<Api: Api> { /* private fields */ }Expand description
A callback that is invoked when an Api::Response
value is received out-of-band (not in reply to a request).
Implementations§
Source§impl<Api: Api> ApiCallback<Api>
 
impl<Api: Api> ApiCallback<Api>
Sourcepub fn new<F: ApiCallbackFn<Api::Response, Fut>, Fut: Future<Output = ()> + Send + Sync + 'static>(
    callback: F,
) -> Self
 
pub fn new<F: ApiCallbackFn<Api::Response, Fut>, Fut: Future<Output = ()> + Send + Sync + 'static>( callback: F, ) -> Self
Returns a new instance wrapping the provided function.
Sourcepub fn new_with_context<Context: Send + Sync + Clone + 'static, F: Fn(Api::Response, Context) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + Sync + 'static>(
    context: Context,
    callback: F,
) -> Self
 
pub fn new_with_context<Context: Send + Sync + Clone + 'static, F: Fn(Api::Response, Context) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + Sync + 'static>( context: Context, callback: F, ) -> Self
Returns a new instance wrapping the provided function, passing a clone
of context as the second parameter. This is just a convenience wrapper
around new() that produces more readable code when needing to access
external information inside of the callback.
Auto Trait Implementations§
impl<Api> Freeze for ApiCallback<Api>
impl<Api> !RefUnwindSafe for ApiCallback<Api>
impl<Api> Send for ApiCallback<Api>
impl<Api> Sync for ApiCallback<Api>
impl<Api> Unpin for ApiCallback<Api>
impl<Api> !UnwindSafe for ApiCallback<Api>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
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<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<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more