1use crate::traits::RingBuffer;
2#[cfg(feature = "alloc")]
3use {crate::alias::Arc, alloc::rc::Rc};
4
5pub unsafe trait RbRef: Clone + AsRef<Self::Rb> {
11 type Rb: RingBuffer + ?Sized;
13 fn rb(&self) -> &Self::Rb {
15 self.as_ref()
16 }
17}
18
19unsafe impl<B: RingBuffer + AsRef<B> + ?Sized> RbRef for &B {
20 type Rb = B;
21}
22#[cfg(feature = "alloc")]
23unsafe impl<B: RingBuffer + ?Sized> RbRef for Rc<B> {
24 type Rb = B;
25}
26#[cfg(feature = "alloc")]
27unsafe impl<B: RingBuffer + ?Sized> RbRef for Arc<B> {
28 type Rb = B;
29}