| 1 | use crate::{Consumer, Producer, SharedRb}; |
| 2 | use core::mem::MaybeUninit; |
| 3 | |
| 4 | #[cfg (feature = "alloc" )] |
| 5 | use alloc::{sync::Arc, vec::Vec}; |
| 6 | |
| 7 | /// Stack-allocated ring buffer with static capacity. |
| 8 | /// |
| 9 | /// *Capacity (`N`) must be greater that zero.* |
| 10 | pub type StaticRb<T, const N: usize> = SharedRb<T, [MaybeUninit<T>; N]>; |
| 11 | /// Alias for [`StaticRb`] [`Producer`]. |
| 12 | pub type StaticProducer<'a, T, const N: usize> = Producer<T, &'a StaticRb<T, N>>; |
| 13 | /// Alias for [`StaticRb`] [`Consumer`]. |
| 14 | pub type StaticConsumer<'a, T, const N: usize> = Consumer<T, &'a StaticRb<T, N>>; |
| 15 | |
| 16 | /// Heap-allocated ring buffer. |
| 17 | #[cfg (feature = "alloc" )] |
| 18 | pub type HeapRb<T> = SharedRb<T, Vec<MaybeUninit<T>>>; |
| 19 | /// Alias for [`HeapRb`] [`Producer`]. |
| 20 | #[cfg (feature = "alloc" )] |
| 21 | pub type HeapProducer<T> = Producer<T, Arc<HeapRb<T>>>; |
| 22 | /// Alias for [`HeapRb`] [`Consumer`]. |
| 23 | #[cfg (feature = "alloc" )] |
| 24 | pub type HeapConsumer<T> = Consumer<T, Arc<HeapRb<T>>>; |
| 25 | |