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