rustzmq2 0.1.0

A native async Rust implementation of ZeroMQ
Documentation
// 01_req_rep_server — REP socket echoing requests with " Reply" appended.
//
// REQ/REP enforces strict alternation: each recv must be followed by exactly
// one send before the next recv. Run alongside 01_req_rep_client.
use rustzmq2::prelude::*;
use std::convert::TryInto;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("Start server");
    let mut socket = rustzmq2::RepSocket::new();
    socket.bind("tcp://127.0.0.1:5555").await?;

    loop {
        let mut repl: String = socket.recv().await?.try_into()?;
        println!("Received: {:?}", repl);
        repl.push_str(" Reply");
        socket.send(repl).await?;
    }
}