Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rust zeromq bindings.
tree: 413d11fdbd

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
Makefile
README.md
example.rs
msgsend-zmq.rs
zmq.rc
zmq.rs

README.md

Rust Zeromq bindings.

To build, just run rustc zmq.rc. rust-zmq is a pretty straight forward port of the C API into Rust:

use zmq;
import zmq::{context, socket, error};

fn main() {
    let ctx = alt zmq::init(1) {
      ok(ctx) { ctx }
      err(e) { fail e.to_str() }
    };

    let socket = alt.ctx.socket(zmq::REQ) {
      ok(socket) { socket }
      err(e) { fail e.to_str() }
    };

    alt socket.connect("tcp://127.0.0.1:1234") {
      ok(()) { }
      err(e) { fail e.to_str() }
    }

    alt socket.send_str("hello world!", 0) {
      ok(()) { }
      err(e) { fail e.to_str() }
    }

    socket.close();
    ctx.close();
}

Installation

Install for users of rust-zmq:

% cargo install zmq

Install for developers:

% git clone https://github.com/erickt/rust-zmq
% cd rust-zmq
% make deps
% make
Something went wrong with that request. Please try again.