pub struct Requester { /* private fields */ }Expand description
Clonable handle for sending requests through the session that created it. Does not keep the session open or follow a replacement session. Dropping a requester does not close the session or cancel operations it already submitted.
Implementations§
Source§impl Requester
impl Requester
Sourcepub fn request(
&self,
request: impl Into<Message>,
deadline: Instant,
) -> Result<Promise<Message>, Error>
pub fn request( &self, request: impl Into<Message>, deadline: Instant, ) -> Result<Promise<Message>, Error>
Queues a request and returns its promise without waiting for the writer or
a reply. A closed session returns an error immediately; errors after queueing
are returned through the promise. The outgoing queue has no capacity limit.
A message invalid for this session’s direction fails the promise with
Error::WrongDirection.
The deadline covers time in the queue, sending and accepting the response.
Waiting on the promise does not start or refresh it. Dropping the promise
does not cancel the request. The peer may keep working after a timeout.
Decoding the response in wait() is outside this deadline.
The expected response type is selected when waiting on Promise<Message>.