/rust/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.10.1/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 | 21.3M | fn with_mut<F, R>(&mut self, f: F) -> R |
17 | 21.3M | where |
18 | 21.3M | F: FnOnce(&mut *mut T) -> R, |
19 | 21.3M | { |
20 | 21.3M | f(self.get_mut()) |
21 | 21.3M | } <core::sync::atomic::AtomicPtr<()> as bytes::loom::sync::atomic::AtomicMut<()>>::with_mut::<bytes::bytes::shared_drop::{closure#0}, ()> Line | Count | Source | 16 | 1.60M | fn with_mut<F, R>(&mut self, f: F) -> R | 17 | 1.60M | where | 18 | 1.60M | F: FnOnce(&mut *mut T) -> R, | 19 | 1.60M | { | 20 | 1.60M | f(self.get_mut()) | 21 | 1.60M | } |
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 | 2.77M | fn with_mut<F, R>(&mut self, f: F) -> R | 17 | 2.77M | where | 18 | 2.77M | F: FnOnce(&mut *mut T) -> R, | 19 | 2.77M | { | 20 | 2.77M | f(self.get_mut()) | 21 | 2.77M | } |
<core::sync::atomic::AtomicPtr<()> as bytes::loom::sync::atomic::AtomicMut<()>>::with_mut::<bytes::bytes_mut::shared_v_drop::{closure#0}, ()> Line | Count | Source | 16 | 16.9M | fn with_mut<F, R>(&mut self, f: F) -> R | 17 | 16.9M | where | 18 | 16.9M | F: FnOnce(&mut *mut T) -> R, | 19 | 16.9M | { | 20 | 16.9M | f(self.get_mut()) | 21 | 16.9M | } |
|
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 | | } |