Struct bonsaidb_client::ApiCallback
source · [−]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
sourceimpl<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> !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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more