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]

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]

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

Auto Trait Implementations

impl<I> Sync for Responder<I> where
    I: Sync

impl<I> Unpin for Responder<I>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.