diff --git a/src/ext.rs b/src/ext.rs index 84a962b..2e5743b 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -1,6 +1,9 @@ use super::*; use std::{ io::{self, Read, Write}, + any::Any, + marker::{Send, Sync}, + fmt, }; pub trait Tuple2Ext: Sized @@ -109,3 +112,16 @@ impl IOCounterReadExt for R } } +/// A boxed `'static` value of anything anything that is `Send` and `Sync`. +#[repr(transparent)] +pub struct Anything(pub Box); + +impl fmt::Debug for Anything +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result + { + write!(f, ": (at: {:p}, sz: {})", + Box::as_ref(&self.0), + std::mem::size_of_val(Box::as_ref(&self.0))) + } +} diff --git a/src/formats.rs b/src/formats.rs index 695ed54..27694aa 100644 --- a/src/formats.rs +++ b/src/formats.rs @@ -11,7 +11,12 @@ use object::Object; mod json; /// Config for the encode/decode -pub struct Config; //TODO: What goes here? +#[derive(Debug)] +pub struct Config{ + //TODO: What goes here? + /// Any arbitrary data. + pub user: Option, +} /// A directive for a format on how to encode and decode objects. #[derive(Clone, Copy)]