pub struct UntypedClient { /* private fields */ }
Expand description
Represents a client that can be used to send requests & receive responses from a server.
§Note
This variant does not validate the payload of requests or responses being sent and received.
Implementations§
Source§impl UntypedClient
impl UntypedClient
Sourcepub fn into_typed_client<T, U>(self) -> Client<T, U>
pub fn into_typed_client<T, U>(self) -> Client<T, U>
Consumes the client, returning a typed variant.
Sourcepub fn into_channel(self) -> UntypedChannel
pub fn into_channel(self) -> UntypedChannel
Convert into underlying channel.
Sourcepub fn clone_channel(&self) -> UntypedChannel
pub fn clone_channel(&self) -> UntypedChannel
Clones the underlying channel for requests and returns the cloned instance.
Sourcepub async fn wait(self) -> Result<()>
pub async fn wait(self) -> Result<()>
Waits for the client to terminate, which resolves when the receiving end of the network connection is closed (or the client is shutdown). Returns whether or not the client exited successfully or due to an error.
Sourcepub fn clone_shutdown(&self) -> Box<dyn Shutdown>
pub fn clone_shutdown(&self) -> Box<dyn Shutdown>
Clones the underlying shutdown signaler for the client. This enables you to wait on the client while still having the option to shut it down from somewhere else.
Sourcepub async fn shutdown(&self) -> Result<()>
pub async fn shutdown(&self) -> Result<()>
Signal for the client to shutdown its connection cleanly.
Sourcepub fn will_shutdown_on_drop(&mut self) -> bool
pub fn will_shutdown_on_drop(&mut self) -> bool
Returns whether the client should fully shutdown once it is dropped. If true, this will result in all channels tied to the client no longer functioning once the client is dropped.
Sourcepub fn shutdown_on_drop(&mut self, shutdown_on_drop: bool)
pub fn shutdown_on_drop(&mut self, shutdown_on_drop: bool)
Sets whether the client should fully shutdown once it is dropped. If true, this will result in all channels tied to the client no longer functioning once the client is dropped.
Sourcepub fn clone_connection_watcher(&self) -> ConnectionWatcher
pub fn clone_connection_watcher(&self) -> ConnectionWatcher
Clones the underlying [ConnectionStateWatcher
] for the client.
Sourcepub fn on_connection_change<F>(&self, f: F) -> JoinHandle<()>
pub fn on_connection_change<F>(&self, f: F) -> JoinHandle<()>
Spawns a new task that continually monitors for connection changes and invokes the function
f
whenever a new change is detected.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns true if client’s underlying event processing has finished/terminated.
Sourcepub fn spawn_inmemory(
transport: FramedTransport<InmemoryTransport>,
config: ClientConfig,
) -> Self
pub fn spawn_inmemory( transport: FramedTransport<InmemoryTransport>, config: ClientConfig, ) -> Self
Spawns a client using the provided FramedTransport
of InmemoryTransport
and a
specific ReconnectStrategy
.
§Note
This will NOT perform any handshakes or authentication procedures nor will it replay any
missing frames. This is to be used when establishing a Client
to be run internally
within a program.
Methods from Deref<Target = UntypedChannel>§
Sourcepub async fn assign_default_mailbox(
&self,
buffer: usize,
) -> Result<Mailbox<UntypedResponse<'static>>>
pub async fn assign_default_mailbox( &self, buffer: usize, ) -> Result<Mailbox<UntypedResponse<'static>>>
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: UntypedRequest<'_>,
) -> Result<Mailbox<UntypedResponse<'static>>>
pub async fn mail( &mut self, req: UntypedRequest<'_>, ) -> Result<Mailbox<UntypedResponse<'static>>>
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: UntypedRequest<'_>,
duration: impl Into<Option<Duration>>,
) -> Result<Mailbox<UntypedResponse<'static>>>
pub async fn mail_timeout( &mut self, req: UntypedRequest<'_>, duration: impl Into<Option<Duration>>, ) -> Result<Mailbox<UntypedResponse<'static>>>
Sends a request and returns a mailbox, timing out after duration has passed
Sourcepub async fn send(
&mut self,
req: UntypedRequest<'_>,
) -> Result<UntypedResponse<'static>>
pub async fn send( &mut self, req: UntypedRequest<'_>, ) -> Result<UntypedResponse<'static>>
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: UntypedRequest<'_>,
duration: impl Into<Option<Duration>>,
) -> Result<UntypedResponse<'static>>
pub async fn send_timeout( &mut self, req: UntypedRequest<'_>, duration: impl Into<Option<Duration>>, ) -> Result<UntypedResponse<'static>>
Sends a request and waits for a response, timing out after duration has passed
Sourcepub async fn fire(&mut self, req: UntypedRequest<'_>) -> Result<()>
pub async fn fire(&mut self, req: UntypedRequest<'_>) -> Result<()>
Sends a request without waiting for a response; this method is able to be used even if the session’s receiving line to the remote server has been severed
Sourcepub async fn fire_timeout(
&mut self,
req: UntypedRequest<'_>,
duration: impl Into<Option<Duration>>,
) -> Result<()>
pub async fn fire_timeout( &mut self, req: UntypedRequest<'_>, duration: impl Into<Option<Duration>>, ) -> Result<()>
Sends a request without waiting for a response, timing out after duration has passed