Struct rpc_it::rpc::Handle

source ·
pub struct Handle { /* private fields */ }
Expand description

Handle to control RPC driver instance.

Implementations§

source§

impl Handle

source

pub fn downgrade(this: &Self) -> WeakHandle

source

pub fn is_closed(&self) -> bool

Check if this RPC channel was closed.

source

pub fn try_recv_inbound(&self) -> Result<Inbound, TryRecvError>

Try to receive single inbound from the remote end.

source

pub async fn recv_inbound(&self) -> Option<Inbound>

Receive single inbound from the remote end asynchronously.

Will return None if the channel is closed.

source

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.

source

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.

source

pub async fn shutdown(&self) -> Result<()>

Shutdown underlying write stream.

source

pub fn post_flush(&self) -> Option<()>

source

pub fn post_shutdown(&self) -> Option<()>

source

pub fn pending_requests(&self) -> usize

Number of pending requests.

source

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.

source

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.

source

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.

source

pub fn post_request( &self, route: &str, payload: Option<PooledBuffer> ) -> Option<ReplyWait>

The request version of the send-notify function.

source

pub fn pool(&self) -> &Arc<VecPool>

Pool an empty buffer from the driver’s internal allocator. It is recommended that you do not write values to the buffer beyond the capacity you pass.

Trait Implementations§

source§

impl Clone for Handle

source§

fn clone(&self) -> Handle

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Handle

§

impl Send for Handle

§

impl Sync for Handle

§

impl Unpin for Handle

§

impl !UnwindSafe for Handle

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.