//! Writer trait. #[cfg(feature = "pem")] pub(crate) mod pem; pub(crate) mod slice; use crate::Result; #[cfg(feature = "std")] use std::io; /// Writer trait which outputs encoded DER. pub trait Writer { /// Write the given DER-encoded bytes as output. fn write(&mut self, slice: &[u8]) -> Result<()>; /// Write a single byte. fn write_byte(&mut self, byte: u8) -> Result<()> { self.write(&[byte]) } } #[cfg(feature = "std")] #[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl Writer for W { fn write(&mut self, slice: &[u8]) -> Result<()> { ::write(self, slice)?; Ok(()) } }