use crate::traits::RingBuffer;
#[cfg(feature = "alloc")]
use {crate::alias::Arc, alloc::rc::Rc};
pub unsafe trait RbRef: Clone + AsRef<Self::Rb> {
type Rb: RingBuffer + ?Sized;
fn rb(&self) -> &Self::Rb {
self.as_ref()
}
}
unsafe impl<B: RingBuffer + AsRef<B> + ?Sized> RbRef for &B {
type Rb = B;
}
#[cfg(feature = "alloc")]
unsafe impl<B: RingBuffer + ?Sized> RbRef for Rc<B> {
type Rb = B;
}
#[cfg(feature = "alloc")]
unsafe impl<B: RingBuffer + ?Sized> RbRef for Arc<B> {
type Rb = B;
}