Struct bonsaidb::client::ApiCallback
pub struct ApiCallback<Api>where
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§
§impl<Api> ApiCallback<Api>where
Api: Api,
impl<Api> ApiCallback<Api>where Api: Api,
pub fn new<F, Fut>(callback: F) -> ApiCallback<Api>where
F: ApiCallbackFn<<Api as Api>::Response, Fut>,
Fut: Future<Output = ()> + Send + Sync + 'static,
pub fn new<F, Fut>(callback: F) -> ApiCallback<Api>where F: ApiCallbackFn<<Api as Api>::Response, Fut>, Fut: Future<Output = ()> + Send + Sync + 'static,
Returns a new instance wrapping the provided function.
pub fn new_with_context<Context, F, Fut>(
context: Context,
callback: F
) -> ApiCallback<Api>where
Context: Send + Sync + Clone + 'static,
F: Fn(<Api as Api>::Response, Context) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ()> + Send + Sync + 'static,
pub fn new_with_context<Context, F, Fut>( context: Context, callback: F ) -> ApiCallback<Api>where Context: Send + Sync + Clone + 'static, F: Fn(<Api as Api>::Response, Context) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + Sync + 'static,
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§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