Struct interchange::Responder [−][src]
pub struct Responder<I: 'static + Interchange> { /* fields omitted */ }
Processing end of the RPC interchange.
The owner of this end must eventually reply to any requests made to it. In case there is a cancelation of the request, this must be acknowledged instead.
Implementations
impl<I: Interchange> Responder<I>
[src]
impl<I: Interchange> Responder<I>
[src]pub fn state(&self) -> State
[src]
Current state of the interchange.
Informational only!
The responder may change this state between calls, internally atomics ensure correctness.
pub fn request(&mut self) -> Option<&I::REQUEST>
[src]
If there is a request waiting, take a reference to it out
This may be called only once as it move the state to BuildingResponse. If you need copies, clone the request.
pub fn take_request(&mut self) -> Option<I::REQUEST>
[src]
If there is a request waiting, take a reference to it out
This may be called only once as it move the state to BuildingResponse. If you need copies, clone the request.
pub fn is_canceled(&self) -> bool
[src]
pub fn acknowledge_cancel(&self) -> Result<(), ()>
[src]
pub fn respond(&mut self, response: &I::RESPONSE) -> Result<(), ()>
[src]
Respond to a request.
If efficiency is a concern, or responses need multiple steps to
construct, use response_mut
and `send_response.
impl<I: Interchange> Responder<I> where
I::RESPONSE: Default,
[src]
impl<I: Interchange> Responder<I> where
I::RESPONSE: Default,
[src]pub fn response_mut(&mut self) -> Option<&mut I::RESPONSE>
[src]
If there is a request waiting that no longer needs to be accessed, may build response into the returned value.
pub fn send_response(&mut self) -> Result<(), ()>
[src]
Send a response that was already placed in the interchange using response_mut
.
Trait Implementations
impl<I: Interchange> Send for Responder<I>
[src]
impl<I: Interchange> Send for Responder<I>
[src]