//! The available formats to convert use super::*; use std::io; use object::{ Object, OwnedObject, }; pub struct Config; /// A directive for a format on how to encode and decode objects. #[derive(Clone, Copy)] pub struct FormatDirective { encode: fn (&Config, &mut dyn io::Write, &dyn Object) -> io::Result, decode: fn (&Config, &mut dyn io::Read) -> io::Result<(OwnedObject<'static>, usize)>, } macro_rules! directive { ($($name:literal),+ => $encode:expr, $decode:expr) => { (&[$($name),+], FormatDirective { encode: $encode, decode: $decode, }) }; } /// All format directives and their name(s) pub static FORMATS: &[(&'static [&'static str], FormatDirective)] = &[ directive!("json" => |_, _, _| todo!(), |_, _| todo!()), directive!("s-expression", "sexpr" => |_, _, _| todo!(), |_, _| todo!()), directive!("cbor" => |_, _, _| todo!(), |_, _| todo!()), ];