| Crates.io | arzmq |
| lib.rs | arzmq |
| version | 0.5.7 |
| created_at | 2025-07-23 20:11:03.011487+00 |
| updated_at | 2025-11-02 12:04:10.115102+00 |
| description | High-level bindings to the zeromq library |
| homepage | |
| repository | https://github.com/mgaertne/arzmq |
| max_upload_size | |
| id | 1765223 |
| size | 762,335 |
The arzmq crate provides bindings for the libzmq library from the
ZeroMQ project. The API exposed by arzmq should
be safe (in the usual Rust sense), but it follows the C API closely,
so it is not very idiomatic.
There are feature flags for enabling a builder interface for contexts and
sockets as well as a feature flag for enabling 0MQ's draft-api available.
The aim of this project is to track latest zmq releases as close as possible.
arzmq is a pretty straight forward port of the C API into Rust:
use std::thread;
use arzmq::prelude::{Context, RequestSocket, ReplySocket, SendFlags, Receiver, RecvFlags, Sender};
fn run_reply(context: &Context, endpoint: &str) {
let socket = ReplySocket::from_context(context).unwrap();
socket.bind(endpoint).unwrap();
thread::spawn(move || {
while socket.recv_msg(RecvFlags::DONT_WAIT).is_err() {}
});
}
fn main() {
let ctx = Context::new().unwrap();
run_reply(&ctx, "tcp://127.0.0.1:1234");
let socket = RequestSocket::from_context(&ctx).unwrap();
socket.connect("tcp://127.0.0.1:1234").unwrap();
let _ = socket.send_msg("hello world!", SendFlags::DONT_WAIT);
}
You can find more usage examples in https://github.com/mgaertne/arzmq/tree/master/examples.