zune_core/bytestream/writer/
std_writer.rs1#![cfg(feature = "std")]
2
3use std::io::Write;
4
5use crate::bytestream::ZByteIoError;
6
7impl<T: Write> crate::bytestream::ZByteWriterTrait for T {
8 fn write_bytes(&mut self, buf: &[u8]) -> Result<usize, ZByteIoError> {
9 self.write(buf).map_err(ZByteIoError::StdIoError)
10 }
11
12 fn write_all_bytes(&mut self, buf: &[u8]) -> Result<(), ZByteIoError> {
13 self.write_all(buf).map_err(ZByteIoError::StdIoError)
14 }
15
16 fn write_const_bytes<const N: usize>(&mut self, buf: &[u8; N]) -> Result<(), ZByteIoError> {
17 self.write_all_bytes(buf)
18 }
19 fn flush_bytes(&mut self) -> Result<(), ZByteIoError> {
20 self.flush().map_err(ZByteIoError::StdIoError)
21 }
22 fn reserve_capacity(&mut self, _: usize) -> Result<(), ZByteIoError> {
23 Ok(())
26 }
27}