wasmer_vm/
function_env.rsuse std::any::Any;
pub struct VMFunctionEnvironment {
contents: Box<dyn Any + Send + 'static>,
}
impl std::fmt::Debug for VMFunctionEnvironment {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("VMFunctionEnvironment")
.field("contents", &(&*self.contents as *const _))
.finish()
}
}
impl VMFunctionEnvironment {
pub fn new(val: impl Any + Send + 'static) -> Self {
Self {
contents: Box::new(val),
}
}
#[allow(clippy::should_implement_trait)]
pub fn as_ref(&self) -> &(dyn Any + Send + 'static) {
&*self.contents
}
#[allow(clippy::should_implement_trait)]
pub fn as_mut(&mut self) -> &mut (dyn Any + Send + 'static) {
&mut *self.contents
}
}