Struct fizyr_rpc::PeerWriteHandle
source · pub struct PeerWriteHandle<Body> { /* private fields */ }
Expand description
Handle to send messages to a peer.
The write handle can be used to send requests and stream messages.
When all read and write handles are dropped, the peer loop is stopped. Any open requests will also be terminated.
Implementations§
source§impl<Body> PeerWriteHandle<Body>
impl<Body> PeerWriteHandle<Body>
sourcepub 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.
sourcepub async fn send_stream(
&self,
service_id: i32,
body: impl Into<Body>
) -> Result<(), Error>
pub async fn send_stream( &self, service_id: i32, body: impl Into<Body> ) -> Result<(), Error>
Send a stream message to the remote peer.
sourcepub fn close_handle(&self) -> PeerCloseHandle<Body>
pub fn close_handle(&self) -> PeerCloseHandle<Body>
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.
Trait Implementations§
source§impl<Body> Clone for PeerWriteHandle<Body>
impl<Body> Clone for PeerWriteHandle<Body>
source§impl<Body> Debug for PeerWriteHandle<Body>
impl<Body> Debug for PeerWriteHandle<Body>
source§impl<Body> Drop for PeerWriteHandle<Body>
impl<Body> Drop for PeerWriteHandle<Body>
Auto Trait Implementations§
impl<Body> !RefUnwindSafe for PeerWriteHandle<Body>
impl<Body> Send for PeerWriteHandle<Body>where
Body: Send,
impl<Body> Sync for PeerWriteHandle<Body>where
Body: Send,
impl<Body> Unpin for PeerWriteHandle<Body>
impl<Body> !UnwindSafe for PeerWriteHandle<Body>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more