ringbuf/
alias.rs

1#[cfg(feature = "alloc")]
2use super::storage::Heap;
3use super::{
4    rb::SharedRb,
5    storage::Array,
6    wrap::{CachingCons, CachingProd},
7};
8
9#[cfg(all(feature = "alloc", not(feature = "portable-atomic")))]
10pub use alloc::sync::Arc;
11#[cfg(all(feature = "alloc", feature = "portable-atomic"))]
12pub use portable_atomic_util::Arc;
13
14/// Stack-allocated ring buffer with static capacity.
15///
16/// *Capacity (`N`) must be greater than zero.*
17pub type StaticRb<T, const N: usize> = SharedRb<Array<T, N>>;
18
19/// Alias for [`StaticRb`] producer.
20pub type StaticProd<'a, T, const N: usize> = CachingProd<&'a StaticRb<T, N>>;
21
22/// Alias for [`StaticRb`] consumer.
23pub type StaticCons<'a, T, const N: usize> = CachingCons<&'a StaticRb<T, N>>;
24
25/// Heap-allocated ring buffer.
26#[cfg(feature = "alloc")]
27pub type HeapRb<T> = SharedRb<Heap<T>>;
28
29#[cfg(feature = "alloc")]
30/// Alias for [`HeapRb`] producer.
31pub type HeapProd<T> = CachingProd<Arc<HeapRb<T>>>;
32
33#[cfg(feature = "alloc")]
34/// Alias for [`HeapRb`] consumer.
35pub type HeapCons<T> = CachingCons<Arc<HeapRb<T>>>;