readme: Add an example to the readme

This commit is contained in:
finga 2023-12-08 01:20:38 +01:00
parent 9513b2b3d5
commit a29aa7971d

View file

@ -1,9 +1,19 @@
# 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(())
}
```