embedded_io/impls/
vec.rs

1use crate::{ErrorType, Write};
2use alloc::vec::Vec;
3
4#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
5impl ErrorType for Vec<u8> {
6    type Error = core::convert::Infallible;
7}
8
9#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
10impl Write for Vec<u8> {
11    #[inline]
12    fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
13        self.extend_from_slice(buf);
14        Ok(buf.len())
15    }
16
17    #[inline]
18    fn flush(&mut self) -> Result<(), Self::Error> {
19        Ok(())
20    }
21}