Struct interchange::Requester[][src]

pub struct Requester<I: 'static + Interchange> { /* fields omitted */ }

Requesting end of the RPC interchange.

The owner of this end initiates RPC by sending a request. It must then either wait until the responder end responds, upon which it can send a new request again. It does so by periodically checking whether take_response is Some. Or it can attempt to cancel, which the responder may or may not honour. For details, see the cancel method.

Implementations

impl<I: Interchange> Requester<I>[src]

pub fn state(&self) -> State[src]

Current state of the interchange.

Note that this is a snapshot, and the responder may change this state between calls.

pub fn request(&mut self, request: I::REQUEST) -> Result<(), I::REQUEST>[src]

Send a request to the responder.

If the RPC state is Idle, this always succeeds, else calling is a logic error and the request is returned.

pub fn cancel(&mut self) -> Result<Option<I::REQUEST>, ()>[src]

Attempt to cancel a request.

If the responder has not taken the request yet, this succeeds and returns the request.

If the responder has taken the request (is processing), we succeed and return None.

In other cases (Idle or Reponsed) there is nothing to cancel and we fail.

pub fn take_response(&mut self) -> Option<I::RESPONSE>[src]

Look for a response.

If the responder has sent a response, we return it.

Trait Implementations

Auto Trait Implementations

impl<I> Sync for Requester<I> where
    I: Sync
[src]

impl<I> Unpin for Requester<I>[src]

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.