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
421 B
17 lines
421 B
use super::*;
|
|
|
|
#[derive(Debug)]
|
|
pub struct SExpressionFormatter;
|
|
|
|
impl Format for SExpressionFormatter
|
|
{
|
|
fn encode<W: io::Write>(_cfg: &Config, to: W, obj: &Object) -> Result<usize, ErrorKind> {
|
|
let mut to = to.with_counter();
|
|
serde_lexpr::to_writer(&mut to, obj)?;
|
|
Ok(to.count())
|
|
}
|
|
fn decode<R: io::Read>(_cfg: &Config, from: R) -> Result<Object, ErrorKind> {
|
|
Ok(serde_lexpr::from_reader(from)?)
|
|
}
|
|
}
|