Struct Connector

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

Create a connection to a STOMP server via TCP, including the connection handshake. If successful, returns a tuple of a message stream and a sender, which may be used to receive and send messages respectively.

virtualhost If no specific virtualhost is desired, it is recommended to set this to the same as the host name that the socket was established against (i.e, the same as the server address).

§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, V: Into<String>> 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) to set the values of the fields. Finally, call .__build() to create the instance of Connector.

Source§

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

Source

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

Source

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

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.