|
|
|
@ -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)))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|