pub type Requester = Endpoint<Req>;Expand description
The requesting half of Req/Rep.
Aliased Type§
pub struct Requester { /* private fields */ }Implementations§
Source§impl Requester
impl Requester
Sourcepub async fn connect(&self, url: &str) -> Result<(), Error>
pub async fn connect(&self, url: &str) -> Result<(), Error>
Connects to weida://host:port/path.
The address is kept: a lost connection is redialled by the runtime
under crate::RuntimeConfig::reconnect, and Requester::events
reports it.
Sourcepub fn disconnect(&self, url: &str) -> bool
pub fn disconnect(&self, url: &str) -> bool
Forgets a dialled address; see Peer::disconnect.
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Number of connected peers.
Sourcepub fn events(&self) -> PeerEvents
pub fn events(&self) -> PeerEvents
The event stream of this requester’s addresses; see Peer::events.
Sourcepub async fn open(
&self,
meta: TransferMeta,
) -> Result<(OutgoingTransfer, ReplyStream), Error>
pub async fn open( &self, meta: TransferMeta, ) -> Result<(OutgoingTransfer, ReplyStream), Error>
Opens one exchange: a request stream and its reply half.
Both halves belong to the same bidirectional QUIC stream, so no correlation identifier is needed and none is sent.
Sourcepub async fn request(&self, body: &[u8]) -> Result<IncomingTransfer, Error>
pub async fn request(&self, body: &[u8]) -> Result<IncomingTransfer, Error>
Sends body as one request and returns the reply stream.
Convenience over Requester::open for small payloads; it never
materializes the reply. The delivery receipt is discarded: a reply is a
stronger answer than a transport acknowledgement, and waiting for both
would only add a round trip.
Sourcepub async fn request_with(
&self,
meta: TransferMeta,
body: &[u8],
) -> Result<IncomingTransfer, Error>
pub async fn request_with( &self, meta: TransferMeta, body: &[u8], ) -> Result<IncomingTransfer, Error>
Like Requester::request, with explicit metadata.