mod buf;
mod bytes;
mod chunk;
mod empty;
mod full_copy;
mod infallible;
mod io_slice;
mod slice;
mod tracked;
#[cfg(test)]
mod tests;
pub use buf::Buf;
pub use chunk::Chunk;
pub use empty::Empty;
pub use full_copy::FullCopy;
pub use infallible::Infallible;
pub use io_slice::IoSlice;
pub use tracked::Tracked;
pub trait Storage {
type Error: 'static;
fn buffered_len(&self) -> usize;
#[inline]
fn buffer_is_empty(&self) -> bool {
self.buffered_len() == 0
}
fn read_chunk(&mut self, watermark: usize) -> Result<Chunk<'_>, Self::Error>;
fn partial_copy_into<Dest>(&mut self, dest: &mut Dest) -> Result<Chunk<'_>, Self::Error>
where
Dest: crate::buffer::writer::Storage + ?Sized;
#[inline]
fn copy_into<Dest>(&mut self, dest: &mut Dest) -> Result<(), Self::Error>
where
Dest: crate::buffer::writer::Storage + ?Sized,
{
let mut chunk = self.partial_copy_into(dest)?;
chunk.infallible_copy_into(dest);
Ok(())
}
#[inline]
fn full_copy(&mut self) -> FullCopy<'_, Self> {
FullCopy::new(self)
}
#[inline]
fn track_read(&mut self) -> Tracked<'_, Self> {
Tracked::new(self)
}
}