start config maybe

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

@ -1,6 +1,9 @@
use super::*;
use std::{
io::{self, Read, Write},
any::Any,
marker::{Send, Sync},
fmt,
};
pub trait Tuple2Ext<T,U>: Sized
@ -109,3 +112,16 @@ impl<R: io::Read> IOCounterReadExt for R
}
}
/// A boxed `'static` value of anything anything that is `Send` and `Sync`.
#[repr(transparent)]
pub struct Anything(pub Box<dyn Any + Send + Sync + 'static>);
impl fmt::Debug for Anything
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
write!(f, "<opaque object>: (at: {:p}, sz: {})",
Box::as_ref(&self.0),
std::mem::size_of_val(Box::as_ref(&self.0)))
}
}

@ -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<Anything>,
}
/// A directive for a format on how to encode and decode objects.
#[derive(Clone, Copy)]

Loading…
Cancel
Save