# ipc-ring48 Cheat Sheet
`ipc-ring48` is a bounded POSIX shared-memory queue for one producer and one consumer, carrying fixed 48-byte messages.
## Build
```bash
rustup target add x86_64-unknown-linux-musl
cargo build --release
```
Binary:
```bash
target/x86_64-unknown-linux-musl/release/ipc-ring48
```
## Queue Lifecycle
Reset:
```bash
Initialise with a power-of-two capacity:
```bash
ipc-ring48 init 1024
```
Inspect:
```bash
ipc-ring48 stats
```
Remove:
```bash
ipc-ring48 unlink
```
## Push
Text:
```bash
ipc-ring48 push-text "ready"
ipc-ring48 push "ready"
```
File:
```bash
ipc-ring48 push-file state.bin
```
Standard input:
```bash
Hex, exactly 96 hex characters:
```bash
ipc-ring48 push-hex 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f
```
Six `u64` values:
```bash
ipc-ring48 push-u64 1 7 13 43 127 255
```
Full queue:
```text
stderr: queue full
exit: 2
```
## Pop
Full view:
```bash
ipc-ring48 pop
```
Text:
```bash
ipc-ring48 pop-text
```
Hex:
```bash
ipc-ring48 pop-hex
```
Binary:
```bash
ipc-ring48 pop-bin > state.bin
```
Six `u64` values:
```bash
ipc-ring48 pop-u64
```
Empty queue:
```text
stderr: queue empty
exit: 2
```
## Library
```rust
use ipc_ring48::{Consumer, Producer};
fn main() -> std::io::Result<()> {
ipc_ring48::unlink()?;
let producer = Producer::create_or_open(1024)?;
let consumer = Consumer::open()?;
producer.push([1_u8; 48]).expect("queue has space");
let message = consumer.pop().expect("queue has one message");
assert_eq!(message, [1_u8; 48]);
Ok(())
}
```
## Constants
```rust
ipc_ring48::SHM_NAME // "/ipc_ring48_queue"
ipc_ring48::PAYLOAD_SIZE // 48
```
## Verification
```bash
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test
cargo build --release
cargo doc --no-deps
cargo package
cargo publish --dry-run
```