You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
405 B
17 lines
405 B
use super::*;
|
|
|
|
#[derive(Debug)]
|
|
pub struct CborFormatter;
|
|
|
|
impl Format for CborFormatter
|
|
{
|
|
fn encode<W: io::Write>(_cfg: &Config, to: W, obj: &Object) -> Result<usize, ErrorKind> {
|
|
let mut to = to.with_counter();
|
|
serde_cbor::to_writer(&mut to, obj)?;
|
|
Ok(to.count())
|
|
}
|
|
fn decode<R: io::Read>(_cfg: &Config, from: R) -> Result<Object, ErrorKind> {
|
|
Ok(serde_cbor::from_reader(from)?)
|
|
}
|
|
}
|