Sha256: 929b293ed5f618bf5d8b813704e20ff8e27523f69aeeba8bdd613cc8150e474c

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

use crate::{BufRead, ErrorType, Read, ReadReady, Seek, Write, WriteReady};
use alloc::boxed::Box;

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
impl<T: ?Sized + ErrorType> ErrorType for Box<T> {
    type Error = T::Error;
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
impl<T: ?Sized + Read> Read for Box<T> {
    #[inline]
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
        T::read(self, buf)
    }
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
impl<T: ?Sized + BufRead> BufRead for Box<T> {
    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<T: ?Sized + Write> Write for Box<T> {
    #[inline]
    fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
        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<T: ?Sized + Seek> Seek for Box<T> {
    #[inline]
    fn seek(&mut self, pos: crate::SeekFrom) -> Result<u64, Self::Error> {
        T::seek(self, pos)
    }
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
impl<T: ?Sized + ReadReady> ReadReady for Box<T> {
    #[inline]
    fn read_ready(&mut self) -> Result<bool, Self::Error> {
        T::read_ready(self)
    }
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
impl<T: ?Sized + WriteReady> WriteReady for Box<T> {
    #[inline]
    fn write_ready(&mut self) -> Result<bool, Self::Error> {
        T::write_ready(self)
    }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-28.0.0 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-27.0.0 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-26.0.0 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-25.0.2 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-25.0.1 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-25.0.0 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs
wasmtime-24.0.0 ./ext/cargo-vendor/embedded-io-0.6.1/src/impls/boxx.rs