Struct Connector

Source
pub struct Connector<S: ToSocketAddrs + Clone, V: Into<String> + Clone> { /* private fields */ }
Expand description

A builder for creating and establishing STOMP connections to a server

This struct provides a builder pattern for configuring the connection parameters and then connecting to a STOMP server.

§Examples

use async_stomp::client::Connector;

#[tokio::main]
async fn main() {
  let connection = Connector::builder()
    .server("stomp.example.com")
    .virtualhost("stomp.example.com")
    .login("guest".to_string())
    .passcode("guest".to_string())
    .connect()
    .await;
}

Implementations§

Source§

impl<S: ToSocketAddrs + Clone, V: Into<String> + Clone> Connector<S, V>

Source

pub fn builder() -> ConnectorBuilder<S, V, ((), (), (), (), (), (), ())>

Create a builder for building Connector. On the builder, call .server(...), .virtualhost(...), .login(...)(optional), .passcode(...)(optional), .headers(...)(optional), .use_tls(...)(optional), .tls_server_name(...)(optional) to set the values of the fields. Finally, call .__build() to create the instance of Connector.

Source§

impl<S: ToSocketAddrs + Clone, V: Into<String> + Clone> Connector<S, V>

Source

pub async fn connect(self) -> Result<ClientTransport, Error>

Connect to the STOMP server using the configured parameters

This method establishes a connection to the STOMP server and performs the STOMP protocol handshake. If successful, it returns a ClientTransport that can be used to send and receive STOMP messages.

Source

pub fn msg(self) -> Message<ToServer>

Create a CONNECT message without actually connecting

This method creates a STOMP CONNECT message using the configured parameters which can be used to establish a connection manually.

Auto Trait Implementations§

§

impl<S, V> Freeze for Connector<S, V>
where S: Freeze, V: Freeze,

§

impl<S, V> RefUnwindSafe for Connector<S, V>

§

impl<S, V> Send for Connector<S, V>
where S: Send, V: Send,

§

impl<S, V> Sync for Connector<S, V>
where S: Sync, V: Sync,

§

impl<S, V> Unpin for Connector<S, V>
where S: Unpin, V: Unpin,

§

impl<S, V> UnwindSafe for Connector<S, V>
where S: UnwindSafe, V: UnwindSafe,

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