tiny_artnet_bytes_no_atomic/
loom.rs1#![cfg_attr(not(feature = "std"), allow(unused_imports))]
2
3#[cfg(not(all(test, loom)))]
4pub(crate) mod sync {
5 #[cfg(not(bytes_no_atomic_cas))]
6 pub(crate) mod atomic {
7 pub(crate) use core::sync::atomic::{fence, AtomicPtr, AtomicUsize, Ordering};
8
9 pub(crate) trait AtomicMut<T> {
10 fn with_mut<F, R>(&mut self, f: F) -> R
11 where
12 F: FnOnce(&mut *mut T) -> R;
13 }
14
15 impl<T> AtomicMut<T> for AtomicPtr<T> {
16 fn with_mut<F, R>(&mut self, f: F) -> R
17 where
18 F: FnOnce(&mut *mut T) -> R,
19 {
20 f(self.get_mut())
21 }
22 }
23 }
24}
25
26#[cfg(all(test, loom))]
27pub(crate) mod sync {
28 pub(crate) mod atomic {
29 pub(crate) use loom::sync::atomic::{fence, AtomicPtr, AtomicUsize, Ordering};
30
31 pub(crate) trait AtomicMut<T> {}
32 }
33}