formats individual skel

master
Avril 4 years ago
parent cd1bd5f7da
commit ad442d6678
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -9,6 +9,10 @@ use object::Object;
/// `Format` impl for JSON. /// `Format` impl for JSON.
mod json; mod json;
/// `Format` impl for S expressions.
mod sexpr;
/// `Format` impl for CBOR.
mod cbor;
/// Config for the encode/decode /// Config for the encode/decode
#[derive(Debug)] #[derive(Debug)]
@ -54,8 +58,8 @@ macro_rules! directive {
/// All format directives and their name(s) /// All format directives and their name(s)
pub static FORMATS: &[(&'static [&'static str], FormatDirective)] = &[ pub static FORMATS: &[(&'static [&'static str], FormatDirective)] = &[
directive!(for json::JsonFormatter => "json", "js", "javascript"), directive!(for json::JsonFormatter => "json", "js", "javascript"),
directive!("s-expression", "sexpr", "lisp", "lexpr" => |_, _, _| todo!(), |_, _| todo!()), directive!(for sexpr::SExpressionFormatter => "s-expression", "sexpr", "lisp", "lexpr"),
directive!("cbor" => |_, _, _| todo!(), |_, _| todo!()), directive!(for cbor::CborFormatter => "cbor"),
]; ];
/// A formatting error kind. See `Error`. /// A formatting error kind. See `Error`.

@ -0,0 +1,14 @@
use super::*;
#[derive(Debug)]
pub struct CborFormatter;
impl Format for CborFormatter
{
fn encode<W: io::Write>(cfg: &Config, to: W, obj: &Object) -> Result<usize, Error> {
todo!()
}
fn decode<R: io::Read>(cfg: &Config, from: R) -> Result<Object, Error> {
todo!()
}
}

@ -0,0 +1,14 @@
use super::*;
#[derive(Debug)]
pub struct SExpressionFormatter;
impl Format for SExpressionFormatter
{
fn encode<W: io::Write>(cfg: &Config, to: W, obj: &Object) -> Result<usize, Error> {
todo!()
}
fn decode<R: io::Read>(cfg: &Config, from: R) -> Result<Object, Error> {
todo!()
}
}
Loading…
Cancel
Save