pub struct Handle { /* private fields */ }
Expand description
Handle to control RPC driver instance.
Implementations§
source§impl Handle
impl Handle
pub fn downgrade(this: &Self) -> WeakHandle
sourcepub fn try_recv_inbound(&self) -> Result<Inbound, TryRecvError>
pub fn try_recv_inbound(&self) -> Result<Inbound, TryRecvError>
Try to receive single inbound from the remote end.
sourcepub async fn recv_inbound(&self) -> Option<Inbound>
pub async fn recv_inbound(&self) -> Option<Inbound>
Receive single inbound from the remote end asynchronously.
Will return None
if the channel is closed.
sourcepub async fn blocking_recv_inbound(&self) -> Option<Inbound>
pub async fn blocking_recv_inbound(&self) -> Option<Inbound>
Receive single inbound from the remote end synchronously.
Will block until an inbound is available, or the channel is closed.
sourcepub async fn flush(&self) -> Result<()>
pub async fn flush(&self) -> Result<()>
Flush all queued write requests. This is simply a function that forwards flush requests to the internal transport layer.
sourcepub fn pending_requests(&self) -> usize
pub fn pending_requests(&self) -> usize
Number of pending requests.
sourcepub async fn request<'a, T: AsRef<[u8]> + 'a + ?Sized>(
&self,
route: &str,
payload: impl IntoIterator<Item = &'a T>
) -> Result<ReplyWait>
pub async fn request<'a, T: AsRef<[u8]> + 'a + ?Sized>( &self, route: &str, payload: impl IntoIterator<Item = &'a T> ) -> Result<ReplyWait>
Send a request to the remote end, and returns awaitable reply.
sourcepub async fn notify<'a, T: AsRef<[u8]> + 'a + ?Sized>(
&self,
route: &str,
payload: impl IntoIterator<Item = &'a T>
) -> Result<usize>
pub async fn notify<'a, T: AsRef<[u8]> + 'a + ?Sized>( &self, route: &str, payload: impl IntoIterator<Item = &'a T> ) -> Result<usize>
Send a notify to the remote end. This will return after writing all payload to underlying transport.
sourcepub async fn request_n_bytes(
&self,
route: &str,
payload: &mut impl Iterator<Item = &[u8]>
) -> Result<(usize, ReplyWait)>
pub async fn request_n_bytes( &self, route: &str, payload: &mut impl Iterator<Item = &[u8]> ) -> Result<(usize, ReplyWait)>
Send a request to the remote end, and returns awaitable reply.
You can emulate timeout behavior by dropping returned future.
This version returns the number of bytes written.