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