wasmtime/runtime/gc/disabled/
externref.rs

1use crate::runtime::vm::VMGcRef;
2use crate::{
3    store::AutoAssertNoGc, AsContextMut, GcRefImpl, Result, Rooted, StoreContext, StoreContextMut,
4};
5use core::any::Any;
6
7/// Support for `externref` disabled at compile time because the `gc` cargo
8/// feature was not enabled.
9pub enum ExternRef {}
10
11impl GcRefImpl for ExternRef {}
12
13impl ExternRef {
14    pub(crate) fn from_cloned_gc_ref(
15        _store: &mut AutoAssertNoGc<'_>,
16        _gc_ref: VMGcRef,
17    ) -> Rooted<Self> {
18        unreachable!()
19    }
20
21    pub fn data<'a, T>(
22        &self,
23        _store: impl Into<StoreContext<'a, T>>,
24    ) -> Result<&'a (dyn Any + Send + Sync)>
25    where
26        T: 'a,
27    {
28        match *self {}
29    }
30
31    pub fn data_mut<'a, T>(
32        &self,
33        _store: impl Into<StoreContextMut<'a, T>>,
34    ) -> Result<&'a mut (dyn Any + Send + Sync)>
35    where
36        T: 'a,
37    {
38        match *self {}
39    }
40
41    pub unsafe fn from_raw(_store: impl AsContextMut, raw: u32) -> Option<Rooted<Self>> {
42        assert_eq!(raw, 0);
43        None
44    }
45
46    pub unsafe fn to_raw(&self, _store: impl AsContextMut) -> Result<u32> {
47        match *self {}
48    }
49}