3 unstable releases

Uses old Rust 2015

0.8.2-dev5 Nov 7, 2018
0.0.2 Nov 2, 2018
0.0.1 Nov 2, 2018

#363 in #bindings

Download history 132/week @ 2022-03-03 124/week @ 2022-03-10 143/week @ 2022-03-17 128/week @ 2022-03-24 129/week @ 2022-03-31 123/week @ 2022-04-07 147/week @ 2022-04-14 179/week @ 2022-04-21 160/week @ 2022-04-28 154/week @ 2022-05-05 175/week @ 2022-05-12 144/week @ 2022-05-19 143/week @ 2022-05-26 160/week @ 2022-06-02 128/week @ 2022-06-09 136/week @ 2022-06-16

590 downloads per month

MIT/Apache

97KB
2.5K SLoC

Rust ZeroMQ bindings.

Travis Build Status Appveyor Build status Coverage Status Apache 2.0 licensed MIT licensed crates.io docs

Documentation Release Notes

Installation

Currently, rust-zmq requires ZeroMQ 3.2 or newer. For example, on recent Debian-based distributions, you can use the following command to get the prerequiste headers and library installed:

apt install libzmq3-dev

If your OS of choice does not provide packages of a new-enough libzmq, you will first have to install it from source; see https://github.com/zeromq/libzmq/releases.

rust-zmq uses cargo to install. Users should add this to their Cargo.toml file:

[dependencies]
zmq = "0.8"

Install for developers:

% git clone https://github.com/erickt/rust-zmq
% cd rust-zmq
% cargo build

The build normally uses pkg-config to find out about libzmq's location. If that is not available, the environment variable LIBZMQ_PREFIX (or alternatively, LIBZMQ_LIB_DIR and LIBZMQ_INCLUDE_DIR) can be defined to avoid the invocation of pkg-config.

Usage

rust-zmq is a pretty straight forward port of the C API into Rust:

extern crate zmq;

fn main() {
    let ctx = zmq::Context::new();

    let mut socket = ctx.socket(zmq::REQ).unwrap();
    socket.connect("tcp://127.0.0.1:1234").unwrap();
    socket.send_str("hello world!", 0).unwrap();
}

You can find more usage examples in https://github.com/erickt/rust-zmq/tree/master/examples.

Dependencies

~0.1–0.8MB
~19K SLoC