Struct distant_net::client::Channel
source · pub struct Channel<T, U> { /* private fields */ }Expand description
Represents a sender of requests tied to a session, holding onto a weak reference of
mailboxes to relay responses, meaning that once the Client is closed or dropped,
any sent request will no longer be able to receive responses.
Implementations§
source§impl<T, U> Channel<T, U>where
T: Send + Sync + Serialize + 'static,
U: Send + Sync + DeserializeOwned + 'static,
impl<T, U> Channel<T, U>where T: Send + Sync + Serialize + 'static, U: Send + Sync + DeserializeOwned + 'static,
sourcepub fn into_untyped_channel(self) -> UntypedChannel
pub fn into_untyped_channel(self) -> UntypedChannel
Consumes this channel, returning an untyped variant
sourcepub async fn assign_default_mailbox(
&self,
buffer: usize
) -> Result<Mailbox<Response<U>>>
pub async fn assign_default_mailbox( &self, buffer: usize ) -> Result<Mailbox<Response<U>>>
Assigns a default mailbox for any response received that does not match another mailbox.
sourcepub async fn remove_default_mailbox(&self) -> Result<()>
pub async fn remove_default_mailbox(&self) -> Result<()>
Removes the default mailbox used for unmatched responses such that any response without a matching mailbox will be dropped.
sourcepub async fn mail(
&mut self,
req: impl Into<Request<T>>
) -> Result<Mailbox<Response<U>>>
pub async fn mail( &mut self, req: impl Into<Request<T>> ) -> Result<Mailbox<Response<U>>>
Sends a request and returns a mailbox that can receive one or more responses, failing if unable to send a request or if the session’s receiving line to the remote server has already been severed
sourcepub async fn mail_timeout(
&mut self,
req: impl Into<Request<T>>,
duration: impl Into<Option<Duration>>
) -> Result<Mailbox<Response<U>>>
pub async fn mail_timeout( &mut self, req: impl Into<Request<T>>, duration: impl Into<Option<Duration>> ) -> Result<Mailbox<Response<U>>>
Sends a request and returns a mailbox, timing out after duration has passed
sourcepub async fn send(&mut self, req: impl Into<Request<T>>) -> Result<Response<U>>
pub async fn send(&mut self, req: impl Into<Request<T>>) -> Result<Response<U>>
Sends a request and waits for a response, failing if unable to send a request or if the session’s receiving line to the remote server has already been severed
sourcepub async fn send_timeout(
&mut self,
req: impl Into<Request<T>>,
duration: impl Into<Option<Duration>>
) -> Result<Response<U>>
pub async fn send_timeout( &mut self, req: impl Into<Request<T>>, duration: impl Into<Option<Duration>> ) -> Result<Response<U>>
Sends a request and waits for a response, timing out after duration has passed