Library / SDK
zeromq/zmq.rs avatar
zeromq/zmq.rs

zmq.rs: A Native Rust Implementation of ZeroMQ

A native implementation of ØMQ in Rust

1,428 stars141 forksRustMIT

At a glance

What is it?
zmq.rs gives Rust applications native access to selected ZeroMQ socket patterns and transports. It supports Tokio, async-std, and async-dispatcher, but it does not implement the complete ZeroMQ feature set.
Who is it for?
Adopt zmq.rs for Rust applications that need its supported ZMTP socket patterns and transports through an async runtime. Do not choose it when complete ZeroMQ compatibility is mandatory, and verify compatibility against the reference implementation before exchanging messages with existing libzmq peers.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 44 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 20, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The Rust-Native Scope of zmq.rs

zmq.rs addresses applications that want ZeroMQ-style messaging without binding their Rust code to the reference C implementation. The repository describes it as a native Rust alternative to libzmq and positions it within Rust's asynchronous ecosystem. That target is narrower than simply providing a generic Rust wrapper: the project implements ZMTP directly in Rust and exposes familiar socket families through async-aware APIs.

The implemented scope is explicit. TCP is available as a network transport, while IPC is limited to Unix systems. Supported socket patterns cover Request/Response through REQ, REP, DEALER, and ROUTER; Publish/Subscribe through PUB, SUB, XPUB, and XSUB; and Pipeline through PUSH and PULL. The README says the basic ZMTP implementation is working and has been tested against the reference implementation. That statement applies to the basic protocol implementation, not every feature in ZeroMQ.

The project begins with a constraint that should guide adoption: its README opens with the disclaimer that the codebase does not implement all of ZeroMQ's features. It is therefore better suited to greenfield Rust services designed around the listed patterns than to an existing deployment that assumes full libzmq compatibility. The available examples, including broker, server, client, forwarder, proxy, and task distribution programs, indicate that the intended use is service communication rather than a single narrow client library.

ZMTP Sockets, Transports, and Message Flow

The core mechanism is ZMTP, the ZeroMQ transport protocol documented by the project through the ZeroMQ RFC links. Rather than requiring a native libzmq installation, zmq.rs implements the protocol in Rust. Applications choose a socket type, connect or bind the socket through an enabled transport, and exchange multipart messages using ZeroMQ-style socket operations.

The socket types determine the communication pattern. REQ and REP form the direct request-response pair. DEALER and ROUTER provide asynchronous counterparts that can build more flexible routing arrangements. PUB broadcasts messages to matching SUB subscribers, while XPUB and XSUB expose extended publisher and subscriber sides. PUSH and PULL implement the Pipeline pattern in which work items flow toward one or more receiving peers.

Transports are selected through Cargo features. The default `all-transport` feature enables both `ipc-transport` and `tcp-transport`, allowing TCP and Unix IPC where supported. A narrower dependency can enable only `tcp-transport` if the application does not need local IPC. This feature-based design changes what the crate can do at compile time, so transport selection belongs in the initial dependency configuration rather than being treated as a later deployment detail.

The examples directory also contains a forwarder device and an XPUB/XSUB proxy. Their presence shows that device and proxy patterns are legitimate project use cases, but the README does not claim complete coverage of every ZeroMQ extension or socket behavior.

Choosing Tokio, async-std, or async-dispatcher

Runtime choice is controlled by Cargo features. Tokio is the default because the `default` feature list contains `tokio-runtime`. Applications already built around Tokio can use the crate without disabling its default features. Projects using async-std must disable the default features and select `async-std-runtime`, as shown in the README.

The complete alternative dependency configuration documented by the project is:

toml
zeromq = { version = "*", default-features = false, features = ["async-std-runtime", "all-transport"] }

This configuration disables `tokio-runtime` and then selects async-std while retaining both supported transports. The package also exposes `async-dispatcher-runtime`, and its feature list enables dependencies associated with that runtime. The README names async-dispatcher as a supported option, so it is a valid selection when it fits the application's task architecture.

Runtime features are not cosmetic. They determine which asynchronous dependencies Cargo activates. A project migrating between runtimes must account for its executor, I/O integration, application startup, and shutdown model rather than changing one string in isolation. The README does not provide a feature matrix beyond the feature list, so exact runtime combinations and behavior should be checked against the generated crate documentation for the selected release.

Adding zmq.rs and Opening Its API Documentation

The repository is published as the Cargo package `zeromq`, and the package metadata identifies version `0.6.0`. Its declared minimum Rust version is `1.85.0`. The README does not provide a standalone installation command, and the repository information does not show the full contents of an example program, so this tutorial does not invent one.

For the simplest configuration, add the package with its default Tokio runtime and transport features to an application's `Cargo.toml`. The defaults shown in `Cargo.toml` are `tokio-runtime` and `all-transport`. Projects selecting async-std should use the README's explicit dependency form shown in the preceding section. After adding the dependency, build it with the usual Cargo resolution for the project, then use the documentation command explicitly supplied by the README:

bash
cargo doc --open

This opens generated API documentation for the source code. It is the first concrete setup step confirmed by the project documentation. For a real application, the next step is to open one of the named examples under `examples/`, choose a socket pair that matches the message flow, and reproduce that structure in the consuming crate. Relevant files include `message_client.rs`, `message_server.rs`, `socket_client.rs`, `socket_server.rs`, and the weather client and server examples.

Because the README provides links and filenames but not their complete source text, it would be misleading to reproduce an unsupported sample body. The repository itself is the first-use reference for those programs.

Feature Flags as a Compatibility Boundary

Cargo features make the compatibility boundary visible. The package defines `tokio-runtime`, `async-std-runtime`, and `async-dispatcher-runtime` for runtime selection. It also defines `all-transport`, `ipc-transport`, and `tcp-transport`. Since IPC is documented as Unix only, enabling `ipc-transport` does not imply that Unix IPC will be available on Windows.

The feature set is limited in another important way. There is no feature in the documented package metadata for every socket pattern or protocol extension found in ZeroMQ. Users should not infer support merely because a familiar ZeroMQ socket name exists elsewhere in the specification. The README's supported-pattern list is the safer boundary for initial adoption.

The crate metadata also contains internal and development-oriented features such as `bench-internals`. That feature is present for the repository's benchmark infrastructure, not presented as an application requirement. Ordinary consumers should normally retain only the runtime and transport features their service needs.

Release history includes `v0.6.0` and two prereleases, `v0.6.0-pre.2` and `v0.6.0-pre.1`. The README and package metadata do not provide a formal stability policy, semantic-versioning guarantee, migration guide, or compatibility matrix for each release. Applications that depend on subtle socket behavior should therefore pin and verify the crate version rather than assuming every future ZeroMQ feature will be additive.

Why the libzmq Reference Implementation Remains Relevant

The main alternative identified by the project is libzmq, ZeroMQ's reference implementation. The architectural difference is the main adoption issue. zmq.rs implements ZMTP in Rust and is intended to integrate directly with Rust asynchronous execution and dependencies. The reference implementation is the established native counterpart around which the README positions this project, and zmq.rs states that its basic implementation has been tested against it.

Using the reference implementation can be the appropriate choice when an existing deployment needs the breadth of ZeroMQ that zmq.rs explicitly does not provide. The zmq.rs README does not include a feature-by-feature comparison with libzmq, so it cannot establish that either implementation is better for every socket operation. Teams operating mixed-language systems should verify the exact patterns, options, transports, and protocol edge cases used in production.

For a new Rust service with REQ/REP, PUB/SUB, PUSH/PULL, or DEALER/ROUTER requirements, zmq.rs offers a more direct fit because the implementation and runtime integration are native to the Rust dependency graph. For an existing system with broader protocol requirements, the feature disclaimer outweighs the language benefit until the required behavior is confirmed in zmq.rs.

Maintenance, Rust Requirements, and MIT Licensing

The repository is not archived, and its last push was on 2026-09-08. The current package is `zeromq` version `0.6.0`, released as `v0.6.0` on 2026-05-04. The recorded maintenance activity does not erase the project's explicit incomplete-feature warning. Upgrading therefore requires checking the changelog and testing the particular socket behavior used by an application.

The package declares Rust edition `2021` and `rust-version = "1.85.0"`. That minimum can affect organizations pinned to older stable toolchains, shared build images, or policy-controlled Rust versions. Runtime and transport features add upgrade dimensions because changing the executor or transports can pull a different dependency set and expose behavior not covered by a default Tokio plus TCP/IPC build.

The project uses the MIT license. That permits use, modification, distribution, and sublicensing subject to the license text and notice requirements. This is a technical summary, not legal advice. A distributor still needs to retain the required copyright and license notices, and organizations with separate compliance policies should review the repository's `LICENSE.md` themselves.

Editorial conclusion

Adopt zmq.rs for Rust applications that need its supported ZMTP socket patterns and transports through an async runtime. Do not choose it when complete ZeroMQ compatibility is mandatory, and verify compatibility against the reference implementation before exchanging messages with existing libzmq peers. For version 0.6.0, confirm that the build toolchain provides Rust 1.85.0 or newer and that the selected runtime and transport features match the deployment.

Frequently asked questions

Does zmq.rs implement every ZeroMQ feature?

No. The README explicitly states that the codebase does not implement all of ZeroMQ's feature set and lists the currently supported socket patterns and transports as the adoption boundary.

Which async runtimes can zmq.rs use?

The project supports Tokio, async-std, and async-dispatcher through feature flags. Tokio is enabled by default, while selecting async-std requires disabling default features and enabling `async-std-runtime`.

Which transports and Rust version does zmq.rs support?

The documented transports are TCP and Unix IPC. Version `0.6.0` declares Rust `1.85.0` as its minimum supported Rust version.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. zeromq/zmq.rs on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/zeromq-zmq-rs.svg)](https://hysenlabs.com/projects/zeromq-zmq-rs)

Was this useful?