[][src]Module async_zmq::stream

STREAM socket module of Pub-Sub pattern in ZMQ

Use stream function to instantiate a stream socket and the you will be able to use methods from Stream/StreamExt trait.

Example

use async_zmq::{Result, StreamExt};

#[async_std::main]
async fn main() -> Result<()> {
    let mut zmq = async_zmq::stream("tcp://127.0.0.1:5555")?.bind()?;

    while let Some(msg) = zmq.next().await {
        // Received message is a type of Result<MessageBuf>
        let msg = msg?;

        println!("{:?}", msg.iter());
    }
    Ok(())
}

Structs

ZmqStream

The async wrapper of ZMQ socket with STREAM type

Functions

stream

Create a ZMQ socket with STREAM type