#[ allow( clippy ::std_instead_of_alloc, clippy ::std_instead_of_core ) ]
mod private
{
use std ::sync ::Arc;
#[ derive( Debug, Clone ) ]
pub struct Context
{
inner: Arc< dyn core ::any ::Any + Send + Sync >,
}
impl Default for Context
{
fn default() -> Self
{
Self ::new( () )
}
}
impl Context
{
pub fn new< T: Send + Sync + 'static >( value: T ) -> Self
{
Self { inner: Arc ::new( value ) }
}
}
impl Context
{
#[ must_use ]
pub fn get< T: Send + Sync + 'static >( &self ) -> Option< Arc< T > >
{
self.inner.clone().downcast :: < T >().ok()
}
}
}
crate ::mod_interface!
{
orphan use Context;
}