/rust/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.10.0/src/loom.rs
Line | Count | Source |
1 | | #[cfg(not(all(test, loom)))] |
2 | | pub(crate) mod sync { |
3 | | pub(crate) mod atomic { |
4 | | #[cfg(not(feature = "extra-platforms"))] |
5 | | pub(crate) use core::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; |
6 | | #[cfg(feature = "extra-platforms")] |
7 | | pub(crate) use extra_platforms::{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 | 317k | fn with_mut<F, R>(&mut self, f: F) -> R |
17 | 317k | where |
18 | 317k | F: FnOnce(&mut *mut T) -> R, |
19 | 317k | { |
20 | 317k | f(self.get_mut()) |
21 | 317k | } Unexecuted instantiation: <core::sync::atomic::AtomicPtr<()> as bytes::loom::sync::atomic::AtomicMut<()>>::with_mut::<bytes::bytes::shared_drop::{closure#0}, ()> Unexecuted instantiation: <core::sync::atomic::AtomicPtr<()> as bytes::loom::sync::atomic::AtomicMut<()>>::with_mut::<bytes::bytes::promotable_odd_drop::{closure#0}, ()> <core::sync::atomic::AtomicPtr<()> as bytes::loom::sync::atomic::AtomicMut<()>>::with_mut::<bytes::bytes::promotable_even_drop::{closure#0}, ()> Line | Count | Source | 16 | 317k | fn with_mut<F, R>(&mut self, f: F) -> R | 17 | 317k | where | 18 | 317k | F: FnOnce(&mut *mut T) -> R, | 19 | 317k | { | 20 | 317k | f(self.get_mut()) | 21 | 317k | } |
Unexecuted instantiation: <core::sync::atomic::AtomicPtr<()> as bytes::loom::sync::atomic::AtomicMut<()>>::with_mut::<bytes::bytes_mut::shared_v_drop::{closure#0}, ()> |
22 | | } |
23 | | } |
24 | | } |
25 | | |
26 | | #[cfg(all(test, loom))] |
27 | | pub(crate) mod sync { |
28 | | pub(crate) mod atomic { |
29 | | pub(crate) use loom::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; |
30 | | |
31 | | pub(crate) trait AtomicMut<T> {} |
32 | | } |
33 | | } |