pub struct ResponseHandler<P: Worker> { /* private fields */ }
Expand description
Handler available inside the worker function to send a response to the run()
context.
The ResponseHandler
needs to know the Worker
trait implementor as a generic parameter since the
data, which is send to work_response
, must be of the ResponseData
associated type.
Implementations§
Source§impl<P: Worker> ResponseHandler<P>
impl<P: Worker> ResponseHandler<P>
Sourcepub fn respond(
&self,
response_data: P::ResponseData,
) -> Result<(), RespondError<P::ResponseData>>
pub fn respond( &self, response_data: P::ResponseData, ) -> Result<(), RespondError<P::ResponseData>>
Send a response to the run
context.
This method allows the worker to give a response to the run
context. After calling this
method, the host will call worker_response
with the given response data or a copy of it.
If this method fails, the data is considered as untransmitted and is returned to the caller.
Auto Trait Implementations§
impl<P> Freeze for ResponseHandler<P>
impl<P> RefUnwindSafe for ResponseHandler<P>where
P: RefUnwindSafe,
impl<P> !Send for ResponseHandler<P>
impl<P> !Sync for ResponseHandler<P>
impl<P> Unpin for ResponseHandler<P>where
P: Unpin,
impl<P> UnwindSafe for ResponseHandler<P>where
P: UnwindSafe,
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