1#[cfg(feature = "pem")]
4pub(crate) mod pem;
5pub(crate) mod slice;
6
7use crate::Result;
8
9#[cfg(feature = "std")]
10use std::io;
11
12pub trait Writer {
14 fn write(&mut self, slice: &[u8]) -> Result<()>;
16
17 fn write_byte(&mut self, byte: u8) -> Result<()> {
19 self.write(&[byte])
20 }
21}
22
23#[cfg(feature = "std")]
24#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
25impl<W: io::Write> Writer for W {
26 fn write(&mut self, slice: &[u8]) -> Result<()> {
27 <Self as io::Write>::write(self, slice)?;
28 Ok(())
29 }
30}