about summary refs log tree commit diff
path: root/README.md
blob: de112e1010db45189ae8b80bb29e2cb7a73358b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
posix_mq
========

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.

Usage example:

```rust
// 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");
```

[message queue API]: https://linux.die.net/man/7/mq_overview