wasmtime/runtime/gc/disabled/
structref.rs

1use crate::runtime::vm::VMGcRef;
2use crate::{
3    store::{AutoAssertNoGc, StoreContextMut, StoreOpaque},
4    AsContext, AsContextMut, GcRefImpl, Result, Rooted, StructType, Val, I31,
5};
6
7/// Support for `StructRefPre` disabled at compile time because the `gc` cargo
8/// feature was not enabled.
9pub enum StructRefPre {}
10
11/// Support for `structref` disabled at compile time because the `gc` cargo feature
12/// was not enabled.
13pub enum StructRef {}
14
15impl GcRefImpl for StructRef {}
16
17impl StructRef {
18    pub(crate) fn from_cloned_gc_ref(
19        _store: &mut AutoAssertNoGc<'_>,
20        _gc_ref: VMGcRef,
21    ) -> Rooted<Self> {
22        unreachable!()
23    }
24
25    pub fn ty(&self, _store: impl AsContext) -> Result<StructType> {
26        match *self {}
27    }
28
29    pub fn matches_ty(&self, _store: impl AsContext, _ty: &StructType) -> Result<bool> {
30        match *self {}
31    }
32
33    pub(crate) fn _matches_ty(&self, _store: &StoreOpaque, _ty: &StructType) -> Result<bool> {
34        match *self {}
35    }
36
37    pub fn fields<'a, T: 'a>(
38        &self,
39        _store: impl Into<StoreContextMut<'a, T>>,
40    ) -> Result<impl ExactSizeIterator<Item = Val> + 'a> {
41        match *self {}
42        Ok([].into_iter())
43    }
44
45    pub fn field(&self, _store: impl AsContextMut, _index: usize) -> Result<Val> {
46        match *self {}
47    }
48
49    pub fn set_field(&self, _store: impl AsContextMut, _index: usize, _value: Val) -> Result<()> {
50        match *self {}
51    }
52}