Struct fizyr_rpc::PeerHandle [−][src]
pub struct PeerHandle<Body> { /* fields omitted */ }
Expand description
Handle to a peer.
The handle can be used to receive incoming requests and stream messages, and to send requests and stream messages.
When the handle is dropped, the peer loop is stopped. Any open requests will also be terminated.
Implementations
Split the peer in a read handle and a write handle.
Splitting the peer allows you to move both handles into different tasks.
The original handle is consumed, but the peer loop will keep going until all read and write handles are dropped.
Receive the next request or stream message from the remote peer.
Errors for invalid incoming messages are also reported by this function. For example: incoming update messages that are not associated with a received request will be reported as an error here.
pub async fn send_request(
&self,
service_id: i32,
body: impl Into<Body>
) -> Result<SentRequestHandle<Body>, Error>
pub async fn send_request(
&self,
service_id: i32,
body: impl Into<Body>
) -> Result<SentRequestHandle<Body>, Error>
Send a new request to the remote peer.
Send a stream message to the remote peer.
Make a close handle for the peer.
The close handle can be used to close the connection with the remote peer. It can be cloned and moved around independently.