#posix #mq #queue #mqueue


An idiomatic posix message queue wrapper with optional mio integration

3 unstable releases

✓ Uses Rust 2018 edition

0.2.0 Jul 8, 2019
0.1.1 Apr 5, 2019
0.1.0 Mar 25, 2019

#85 in Unix APIs

25 downloads per month

Apache-2.0 / MIT

476 lines


A Rust library for working with posix message queues.

crates.io Build Status License Documentation

let mq = posixmq::PosixMq::open("/queue")?;
let mut buf = vec![0; mq.attributes().max_msg_size];
loop {
    let (priority, len) = mq.receive(&mut buf)?;
    println!("priority: {:3}, message: {}", priority, str::from_utf8(&buf[..len])?);

Supported operating systems

posixmq has been tested to work on Linux, FreeBSD, NetBSD, DragonFly and OmniOS, but not all features are available everywhere. See rustdoc for details.
*macOS, OpenBSD and Windows doesn't have posix message queues, and this crate will fail to compile there.

mio integration

On Linux, FreeBSD and DragonFly posix message queues can be registered with epoll / kqueue, and therefore used with mio. This feature is not enabled by default; enable it in Cargo.toml with:

posixmq = {version="0.2", features=["mio"]}

Also remember to open the message queues in nonblocking mode.

Differences from posix_mq

  • send() and receive() borrows byte slices instead of consuming and producing vectors, avoiding unnecessary allocations.
  • Supports deadlines / timeouts.
  • Optionally integrates with mio.
  • Is dual-licensed Apache-2.0 and MIT instead of only MIT.

Minimum Rust version

The minimum supported Rust version is 1.31.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.