Struct UntypedClient

Source
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

Source

pub fn into_typed_client<T, U>(self) -> Client<T, U>

Consumes the client, returning a typed variant.

Source

pub fn into_channel(self) -> UntypedChannel

Convert into underlying channel.

Source

pub fn clone_channel(&self) -> UntypedChannel

Clones the underlying channel for requests and returns the cloned instance.

Source

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.

Source

pub fn abort(&self)

Abort the client’s current connection by forcing its tasks to abort.

Source

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.

Source

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

Signal for the client to shutdown its connection cleanly.

Source

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.

Source

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.

Source

pub fn clone_connection_watcher(&self) -> ConnectionWatcher

Clones the underlying [ConnectionStateWatcher] for the client.

Source

pub fn on_connection_change<F>(&self, f: F) -> JoinHandle<()>
where F: FnMut(ConnectionState) + Send + 'static,

Spawns a new task that continually monitors for connection changes and invokes the function f whenever a new change is detected.

Source

pub fn is_finished(&self) -> bool

Returns true if client’s underlying event processing has finished/terminated.

Source

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>§

Source

pub fn is_closed(&self) -> bool

Returns true if no more requests can be transferred

Source

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.

Source

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.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Trait Implementations§

Source§

impl Debug for UntypedClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for UntypedClient

Source§

type Target = UntypedChannel

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for UntypedClient

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for UntypedClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<UntypedClient> for UntypedChannel

Source§

fn from(client: UntypedClient) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts reference to Any
Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Converts mutable reference to Any
Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Consumes and produces Box<dyn Any>
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V