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