wasmer/entities/memory/
location.rs1use wasmer_types::MemoryError;
2
3use crate::error::AtomicsError;
4
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7pub struct MemoryLocation {
8 pub(crate) address: u32,
12}
13
14impl MemoryLocation {
15 pub fn new_32(address: u32) -> Self {
17 Self { address }
18 }
19}
20
21impl From<u32> for MemoryLocation {
22 fn from(value: u32) -> Self {
23 Self::new_32(value)
24 }
25}
26
27pub(crate) trait SharedMemoryOps {
29 fn disable_atomics(&self) -> Result<(), MemoryError> {
31 Err(MemoryError::AtomicsNotSupported)
32 }
33
34 fn wake_all_atomic_waiters(&self) -> Result<(), MemoryError> {
36 Err(MemoryError::AtomicsNotSupported)
37 }
38
39 fn notify(&self, _dst: MemoryLocation, _count: u32) -> Result<u32, AtomicsError> {
41 Err(AtomicsError::Unimplemented)
42 }
43
44 fn wait(
46 &self,
47 _dst: MemoryLocation,
48 _timeout: Option<std::time::Duration>,
49 ) -> Result<u32, AtomicsError> {
50 Err(AtomicsError::Unimplemented)
51 }
52}