|
|
|
@ -14,10 +14,15 @@ macro_rules! processor {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO: Move this to `object.rs`. Have a type that polymorphises any `Serialize` object, somehow...
|
|
|
|
|
//This may be impossible. If it is. Nuke this file, and re-do the `FORMATS` table's value type to `fn(...SOMETHING...) -> io::Result<...SOMETHING...>`
|
|
|
|
|
pub type Object = ();
|
|
|
|
|
|
|
|
|
|
pub trait Processor
|
|
|
|
|
{
|
|
|
|
|
//TODO: How to design this trait??? eh...
|
|
|
|
|
fn process_stream(&self, input: &mut dyn serde::Serialize, output: &mut dyn io::Write) -> Result<usize, Error>;
|
|
|
|
|
fn read_object(&self, input: &mut dyn io::Read) -> Result<Object, Error>;
|
|
|
|
|
fn write_object(&self, obj: &Object, output: &mut dyn io::Write) -> Result<usize, Error>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processor!(Json: {
|
|
|
|
|