Struct interchange::Requester [−][src]
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
impl<I: Interchange> Send for Requester<I>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,