#zeromq #ffi

sys arzmq-sys

Low-level bindings to the zeromq library

18 releases (4 breaking)

Uses new Rust 2024

0.6.3 Mar 17, 2026
0.6.2 Mar 17, 2026
0.5.7 Nov 2, 2025
0.5.6 Oct 9, 2025
0.0.1 Jul 23, 2025

#7 in #zmq

Download history 8/week @ 2025-12-11 7/week @ 2025-12-18 61/week @ 2026-02-05 66/week @ 2026-03-12

66 downloads per month
Used in arzmq

MIT/Apache

15MB
330K SLoC

C++ 212K SLoC // 0.1% comments C 62K SLoC // 0.1% comments Visual Studio Project 14K SLoC C# 9K SLoC // 0.3% comments AsciiDoc 7.5K SLoC // 0.0% comments TCL 6K SLoC // 0.2% comments Python 4.5K SLoC // 0.2% comments Java 3.5K SLoC // 0.1% comments Perl 2.5K SLoC // 0.1% comments Visual Studio Solution 2K SLoC M4 1.5K SLoC // 0.3% comments Automake 1.5K SLoC // 0.0% comments Shell 1.5K SLoC // 0.2% comments PlantUML 1K SLoC Rust 675 SLoC // 0.0% comments Batch 396 SLoC // 0.0% comments Scons 273 SLoC // 0.1% comments Forge Config 255 SLoC // 0.9% comments RPM Specfile 224 SLoC // 0.1% comments Objective-C 102 SLoC GNU Style Assembly 56 SLoC

Contains (DOS exe, 180KB) protolib/src/java/ProtolibJni.dll-x64, (Windows DLL, 150KB) protolib/src/java/ProtolibJni.dll, (Cab file, 84KB) libnorm/makefiles/wince/Norm.vco, (Cab file, 84KB) Norm.vco, (Cab file, 99KB) protolib/makefiles/wince/Protolib.vco, (JAR file, 60KB) gradle-wrapper.jar and 8 more.

Asynchronous Rust bindings for 0MQ (arzmq)

Apache 2.0 licensed MIT licensed Crates.io Version docs.rs

Documentation

About

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.

Compatibility

The aim of this project is to track latest zmq releases as close as possible.

Usage

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.

Dependencies