wasmtime/runtime/gc/disabled/
anyref.rs

1use crate::runtime::vm::VMGcRef;
2use crate::{
3    store::{AutoAssertNoGc, StoreOpaque},
4    ArrayRef, AsContext, AsContextMut, GcRefImpl, HeapType, ManuallyRooted, Result, Rooted,
5    StructRef, I31,
6};
7
8/// Support for `anyref` disabled at compile time because the `gc` cargo feature
9/// was not enabled.
10pub enum AnyRef {}
11
12impl From<Rooted<StructRef>> for Rooted<AnyRef> {
13    #[inline]
14    fn from(s: Rooted<StructRef>) -> Self {
15        match s.inner {}
16    }
17}
18
19impl From<ManuallyRooted<StructRef>> for ManuallyRooted<AnyRef> {
20    #[inline]
21    fn from(s: ManuallyRooted<StructRef>) -> Self {
22        match s.inner {}
23    }
24}
25
26impl From<Rooted<ArrayRef>> for Rooted<AnyRef> {
27    #[inline]
28    fn from(s: Rooted<ArrayRef>) -> Self {
29        match s.inner {}
30    }
31}
32
33impl From<ManuallyRooted<ArrayRef>> for ManuallyRooted<AnyRef> {
34    #[inline]
35    fn from(s: ManuallyRooted<ArrayRef>) -> Self {
36        match s.inner {}
37    }
38}
39
40impl GcRefImpl for AnyRef {}
41
42impl AnyRef {
43    pub(crate) fn from_cloned_gc_ref(
44        _store: &mut AutoAssertNoGc<'_>,
45        _gc_ref: VMGcRef,
46    ) -> Rooted<Self> {
47        unreachable!()
48    }
49
50    pub unsafe fn from_raw(_store: impl AsContextMut, raw: u32) -> Option<Rooted<Self>> {
51        assert_eq!(raw, 0);
52        None
53    }
54
55    pub unsafe fn to_raw(&self, _store: impl AsContextMut) -> Result<u32> {
56        match *self {}
57    }
58
59    pub fn ty(&self, _store: impl AsContext) -> Result<HeapType> {
60        match *self {}
61    }
62
63    pub(crate) fn _ty(&self, _store: &StoreOpaque) -> Result<HeapType> {
64        match *self {}
65    }
66
67    pub fn matches_ty(&self, _store: impl AsContext, _ty: &HeapType) -> Result<bool> {
68        match *self {}
69    }
70
71    pub fn is_i31(&self, _store: impl AsContext) -> Result<bool> {
72        match *self {}
73    }
74
75    pub(crate) fn _is_i31(&self, _store: &StoreOpaque) -> Result<bool> {
76        match *self {}
77    }
78
79    pub fn as_i31(&self, _store: impl AsContext) -> Result<Option<I31>> {
80        match *self {}
81    }
82
83    pub fn unwrap_i31(&self, _store: impl AsContext) -> Result<I31> {
84        match *self {}
85    }
86
87    pub fn is_struct(&self, _store: impl AsContext) -> Result<bool> {
88        match *self {}
89    }
90
91    pub(crate) fn _is_struct(&self, _store: &StoreOpaque) -> Result<bool> {
92        match *self {}
93    }
94
95    pub fn as_struct(&self, _store: impl AsContext) -> Result<Option<StructRef>> {
96        match *self {}
97    }
98
99    pub(crate) fn _as_struct(&self, _store: &StoreOpaque) -> Result<Option<StructRef>> {
100        match *self {}
101    }
102
103    pub fn unwrap_struct(&self, _store: impl AsContext) -> Result<StructRef> {
104        match *self {}
105    }
106
107    pub fn is_array(&self, _store: impl AsContext) -> Result<bool> {
108        match *self {}
109    }
110
111    pub(crate) fn _is_array(&self, _store: &StoreOpaque) -> Result<bool> {
112        match *self {}
113    }
114
115    pub fn as_array(&self, _store: impl AsContext) -> Result<Option<ArrayRef>> {
116        match *self {}
117    }
118
119    pub(crate) fn _as_array(&self, _store: &StoreOpaque) -> Result<Option<ArrayRef>> {
120        match *self {}
121    }
122
123    pub fn unwrap_array(&self, _store: impl AsContext) -> Result<ArrayRef> {
124        match *self {}
125    }
126}