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.
pub fn post_flush(&self) -> Option<()>
pub fn post_shutdown(&self) -> Option<()>
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<()>
pub async fn notify<'a, T: AsRef<[u8]> + 'a + ?Sized>( &self, route: &str, payload: impl IntoIterator<Item = &'a T> ) -> Result<()>
Send a notify to the remote end. This will return after writing all payload to underlying transport.
sourcepub fn post_notify(
&self,
route: &str,
payload: Option<PooledBuffer>
) -> Option<()>
pub fn post_notify( &self, route: &str, payload: Option<PooledBuffer> ) -> Option<()>
The non-blocking version of the notify function. Instead of waiting for the returned future object to send the message immediately, it pools a new buffer to generate the header and requests a separate write driver task to send it.
Because it pushes a buffer into the channel and immediately returns it, we don’t know if the send operation itself was successful or not.
If the transmission fails because the driver channel is closed, return the buffer you passed in.
sourcepub fn post_request(
&self,
route: &str,
payload: Option<PooledBuffer>
) -> Option<ReplyWait>
pub fn post_request( &self, route: &str, payload: Option<PooledBuffer> ) -> Option<ReplyWait>
The request version of the send-notify function.