karec / rust-zmq

Rust zeromq bindings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust ZeroMQ bindings.

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

Installation

Currently, rust-zmq requires ZeroMQ 4.1 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]
git = "https://github.com/erickt/rust-zmq.git"

Install for developers:

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

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.

About

Rust zeromq bindings.

License:Apache License 2.0


Languages

Language:Rust 100.0%