pub mod atomic;
pub mod unbounded;
pub trait Buffer<T> {
#[inline]
fn is_empty(&self) -> bool {
self.len() == 0
}
fn len(&self) -> usize;
fn capacity(&self) -> usize;
fn clear(&mut self);
}
pub trait ReadableBuffer<T>: Buffer<T> {
fn pull(&mut self, dest: &mut [T]) -> usize where T: Copy {
let count = self.copy_to(dest);
self.consume(count)
}
fn copy_to(&self, dest: &mut [T]) -> usize where T: Copy;
fn consume(&mut self, count: usize) -> usize;
}
pub trait WritableBuffer<T>: Buffer<T> {
fn push(&mut self, src: &[T]) -> usize where T: Copy;
}