wasmtime_runtime/threads/
shared_memory_disabled.rs

1#![allow(missing_docs)]
2
3use crate::{RuntimeLinearMemory, Store, VMMemoryDefinition, WaitResult};
4use anyhow::{bail, Result};
5use std::ops::Range;
6use std::time::Instant;
7use wasmtime_environ::{MemoryPlan, Trap};
8
9#[derive(Clone)]
10pub enum SharedMemory {}
11
12impl SharedMemory {
13    pub fn wrap(
14        _plan: &MemoryPlan,
15        _memory: Box<dyn RuntimeLinearMemory>,
16        _ty: wasmtime_environ::Memory,
17    ) -> Result<Self> {
18        bail!("support for shared memories was disabled at compile time");
19    }
20
21    pub fn ty(&self) -> wasmtime_environ::Memory {
22        match *self {}
23    }
24
25    pub fn as_memory(self) -> crate::Memory {
26        match self {}
27    }
28
29    pub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition {
30        match *self {}
31    }
32
33    pub fn grow(
34        &self,
35        _delta_pages: u64,
36        _store: Option<&mut dyn Store>,
37    ) -> Result<Option<(usize, usize)>> {
38        match *self {}
39    }
40
41    pub fn atomic_notify(&self, _addr_index: u64, _count: u32) -> Result<u32, Trap> {
42        match *self {}
43    }
44
45    pub fn atomic_wait32(
46        &self,
47        _addr_index: u64,
48        _expected: u32,
49        _timeout: Option<Instant>,
50    ) -> Result<WaitResult, Trap> {
51        match *self {}
52    }
53
54    pub fn atomic_wait64(
55        &self,
56        _addr_index: u64,
57        _expected: u64,
58        _timeout: Option<Instant>,
59    ) -> Result<WaitResult, Trap> {
60        match *self {}
61    }
62}
63
64impl RuntimeLinearMemory for SharedMemory {
65    fn byte_size(&self) -> usize {
66        match *self {}
67    }
68
69    fn maximum_byte_size(&self) -> Option<usize> {
70        match *self {}
71    }
72
73    fn grow(
74        &mut self,
75        _delta_pages: u64,
76        _store: Option<&mut dyn Store>,
77    ) -> Result<Option<(usize, usize)>> {
78        match *self {}
79    }
80
81    fn grow_to(&mut self, _size: usize) -> Result<()> {
82        match *self {}
83    }
84
85    fn vmmemory(&mut self) -> VMMemoryDefinition {
86        match *self {}
87    }
88
89    fn needs_init(&self) -> bool {
90        match *self {}
91    }
92
93    fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
94        match *self {}
95    }
96
97    fn wasm_accessible(&self) -> Range<usize> {
98        match *self {}
99    }
100}