#![cfg_attr(
feature = "alloc",
doc = r##"
## Simple
```rust
use ringbuf::HeapRb;
# fn main() {
let rb = HeapRb::<i32>::new(2);
let (mut prod, mut cons) = rb.split();
prod.push(0).unwrap();
prod.push(1).unwrap();
assert_eq!(prod.push(2), Err(2));
assert_eq!(cons.pop(), Some(0));
prod.push(2).unwrap();
assert_eq!(cons.pop(), Some(1));
assert_eq!(cons.pop(), Some(2));
assert_eq!(cons.pop(), None);
# }
```
"##
)]
#![doc = r##"
## No heap
```rust
use ringbuf::StaticRb;
# fn main() {
const RB_SIZE: usize = 1;
let mut rb = StaticRb::<i32, RB_SIZE>::default();
let (mut prod, mut cons) = rb.split_ref();
assert_eq!(prod.push(123), Ok(()));
assert_eq!(prod.push(321), Err(321));
assert_eq!(cons.pop(), Some(123));
assert_eq!(cons.pop(), None);
# }
```
"##]
# requires exclusive access to the ring buffer
so to perform it concurrently you need to guard the ring buffer with [`Mutex`](`std::sync::Mutex`) or some other lock.
"##
)]
#![no_std]
#![cfg_attr(feature = "bench", feature(test))]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
mod alias;
mod utils;
pub mod consumer;
pub mod producer;
pub mod ring_buffer;
mod transfer;
#[cfg(feature = "alloc")]
pub use alias::{HeapConsumer, HeapProducer, HeapRb};
pub use alias::{StaticConsumer, StaticProducer, StaticRb};
pub use consumer::Consumer;
pub use producer::Producer;
pub use ring_buffer::{LocalRb, Rb, SharedRb};
pub use transfer::transfer;
#[cfg(test)]
mod tests;
#[cfg(feature = "bench")]
extern crate test;
#[cfg(feature = "bench")]
mod benchmarks;