substrate_wasmtime/
ref.rs1#![allow(missing_docs)]
2
3use std::any::Any;
4use wasmtime_runtime::VMExternRef;
5
6#[derive(Clone, Debug)]
8pub struct ExternRef {
9 pub(crate) inner: VMExternRef,
10}
11
12impl ExternRef {
13 pub fn new<T>(value: T) -> ExternRef
15 where
16 T: 'static + Any,
17 {
18 let inner = VMExternRef::new(value);
19 ExternRef { inner }
20 }
21
22 pub fn data(&self) -> &dyn Any {
24 &*self.inner
25 }
26
27 pub fn strong_count(&self) -> usize {
29 self.inner.strong_count()
30 }
31
32 pub fn ptr_eq(&self, other: &ExternRef) -> bool {
37 VMExternRef::eq(&self.inner, &other.inner)
38 }
39}