use crate::{BufRead, ErrorType, Read, ReadReady, Seek, Write, WriteReady}; use alloc::boxed::Box; #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl ErrorType for Box { type Error = T::Error; } #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl Read for Box { #[inline] fn read(&mut self, buf: &mut [u8]) -> Result { T::read(self, buf) } } #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl BufRead for Box { fn fill_buf(&mut self) -> Result<&[u8], Self::Error> { T::fill_buf(self) } fn consume(&mut self, amt: usize) { T::consume(self, amt) } } #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl Write for Box { #[inline] fn write(&mut self, buf: &[u8]) -> Result { T::write(self, buf) } #[inline] fn flush(&mut self) -> Result<(), Self::Error> { T::flush(self) } } #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl Seek for Box { #[inline] fn seek(&mut self, pos: crate::SeekFrom) -> Result { T::seek(self, pos) } } #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl ReadReady for Box { #[inline] fn read_ready(&mut self) -> Result { T::read_ready(self) } } #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] impl WriteReady for Box { #[inline] fn write_ready(&mut self) -> Result { T::write_ready(self) } }