readme: Add an example to the readme
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
ce11d8cae5
commit
9cc99b8beb
1 changed files with 17 additions and 5 deletions
22
README.md
22
README.md
|
@ -1,9 +1,21 @@
|
||||||
|
![status-badge](https://ci.onders.org/api/badges/finga/sysvmq/status.svg?branch=main)
|
||||||
|
|
||||||
# Sysvmq
|
# Sysvmq
|
||||||
|
|
||||||
This aims to be a easy usable API for SysV IPC message queues.
|
This library provides a convenient and easy usable API for SysV IPC
|
||||||
|
message queues.
|
||||||
|
|
||||||
Note: This library is work in progress.
|
```rust
|
||||||
|
use sysvmq::{SysvMq, SysvMqError};
|
||||||
|
|
||||||
Currently supported operations are only `create` and `unlink`. The
|
fn example() -> Result<(), SysvMqError> {
|
||||||
`create` operation creates a SysV IPC message queue and the `unlink`
|
let mut mq = SysvMq::new(0)?;
|
||||||
operation deletes such a SysV IPC message queue.
|
let mut buf = [0u8; 11];
|
||||||
|
|
||||||
|
mq.send(b"hello queue")?;
|
||||||
|
mq.recv(&mut buf)?;
|
||||||
|
mq.delete()?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue