[][src]Struct cord_client::Subscriber

pub struct Subscriber { /* fields omitted */ }

A Subscriber encapsulates a stream of events for a subscribed namespace. It is created by Client::subscribe().

Examples


let mut conn = Client::connect("127.0.0.1:7101".parse().unwrap()).await?;
conn.subscribe("/users/".into())
    .and_then(|sub| async {
        sub.for_each(|(namespace, data)| {
            // Handle the message...
            dbg!("Received the namespace '{}' with data: {}", namespace, data);
            future::ready(())
        })
        .await;
        Ok(())
    })
    .await

Trait Implementations

impl Stream for Subscriber[src]

type Item = (Pattern, String)

Values yielded by the stream.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<St> StreamExt for St where
    St: Stream + ?Sized
[src]

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.