depot/third_party/tvl/ops/posix_mq.rs
Default email c4fb0432ae Project import generated by Copybara.
GitOrigin-RevId: 3fc1143a04da49a92c3663813c6a0c1e8ccd477f
2020-09-29 23:42:59 -04:00
..
src Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
.gitignore Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
Cargo.lock Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
Cargo.toml Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
CODE_OF_CONDUCT.md Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
default.nix Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
LICENSE Project import generated by Copybara. 2020-09-29 23:42:59 -04:00
README.md Project import generated by Copybara. 2020-09-29 23:42:59 -04:00

posix_mq

Build Status crates.io

This is a simple, relatively high-level library for the POSIX message queue API. It wraps the lower-level API in a simpler interface with more robust error handling.

Check out this project's sister library in Kotlin.

Usage example:

// Values that need to undergo validation are wrapped in safe types:
let name = Name::new("/test-queue").unwrap();

// Queue creation with system defaults is simple:
let queue = Queue::open_or_create(name).expect("Opening queue failed");

// Sending a message:
let message = Message {
  data: "test-message".as_bytes().to_vec(),
  priority: 0,
};
queue.send(&message).expect("message sending failed");

// ... and receiving it!
let result = queue.receive().expect("message receiving failed");