pub struct Subscriber<S: Into<String>, I: Into<String>> { /* private fields */ }Expand description
Builder to create a Subscribe message with optional custom headers
This struct provides a builder pattern for configuring subscription parameters and creating a SUBSCRIBE message to send to a STOMP server.
§Examples
use futures::prelude::*;
use async_stomp::client::Connector;
use async_stomp::client::Subscriber;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
  let mut connection = Connector::builder()
    .server("stomp.example.com")
    .virtualhost("stomp.example.com")
    .login("guest".to_string())
    .passcode("guest".to_string())
    .headers(vec![("client-id".to_string(), "ClientTest".to_string())])
    .connect()
    .await.expect("Client connection");
   
  let subscribe_msg = Subscriber::builder()
    .destination("queue.test")
    .id("custom-subscriber-id")
    .subscribe();
  connection.send(subscribe_msg).await?;
  Ok(())
}Implementations§
Auto Trait Implementations§
impl<S, I> Freeze for Subscriber<S, I>
impl<S, I> RefUnwindSafe for Subscriber<S, I>where
    S: RefUnwindSafe,
    I: RefUnwindSafe,
impl<S, I> Send for Subscriber<S, I>
impl<S, I> Sync for Subscriber<S, I>
impl<S, I> Unpin for Subscriber<S, I>
impl<S, I> UnwindSafe for Subscriber<S, I>where
    S: UnwindSafe,
    I: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more