Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 //! Mutex and RwLock types that do not poison themselves.
2 //!
3 //! These types expose identical APIs to the standard library `Mutex` and
4 //! `RwLock` except that they do not return `PoisonError`s.
5 #![doc(html_root_url="https://sfackler.github.io/rust-antidote/doc/v1.0.0")]
6 #![warn(missing_docs)]
7
8 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
9 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
10 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#, DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut#};
11 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/;
12 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#;
13
14 #[doc(inline)]
15 pub use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::WaitTimeoutResultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/WaitTimeoutResult#;
16
17 /// Like `std::sync::Mutex` except that it does not poison itself.
18 pub struct Mutexrust-analyzer cargo antidote 1.0.0 Mutex#<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#<T>);
19
20 impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Mutexrust-analyzer cargo antidote 1.0.0 Mutex#<T> {
21 fn fmtrust-analyzer cargo antidote 1.0.0 impl#[`Mutex<T>`][Debug]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
22 fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#::fmtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`][Debug]fmt().(&self.0rust-analyzer cargo antidote 1.0.0 Mutex#0., fmt)
23 }
24 }
25
26 impl<T> Mutexrust-analyzer cargo antidote 1.0.0 Mutex#<T> {
27 /// Like `std::sync::Mutex::new`.
28 #[inline]
29 pub fn newrust-analyzer cargo antidote 1.0.0 impl#[`Mutex<T>`]new().(t: T) -> Mutexrust-analyzer cargo antidote 1.0.0 Mutex#<T> {
30 Mutexrust-analyzer cargo antidote 1.0.0 Mutex#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]new().(t))
31 }
32
33 /// Like `std::sync::Mutex::into_inner`.
34 #[inline]
35 pub fn into_innerrust-analyzer cargo antidote 1.0.0 impl#[`Mutex<T>`]into_inner().(self) -> T {
36 self.0rust-analyzer cargo antidote 1.0.0 Mutex#0..into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]into_inner().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())
37 }
38 }
39
40 impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Mutexrust-analyzer cargo antidote 1.0.0 Mutex#<T> {
41 /// Like `std::sync::Mutex::lock`.
42 #[inline]
43 pub fn lockrust-analyzer cargo antidote 1.0.0 impl#[`Mutex<T>`]lock().<'a>(&'a self) -> MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T> {
44 MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#(self.0rust-analyzer cargo antidote 1.0.0 Mutex#0..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().()))
45 }
46
47 /// Like `std::sync::Mutex::try_lock`.
48 #[inline]
49 pub fn try_lockrust-analyzer cargo antidote 1.0.0 impl#[`Mutex<T>`]try_lock().<'a>(&'a self) -> TryLockResultrust-analyzer cargo antidote 1.0.0 TryLockResult#<MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T>> {
50 match self.0rust-analyzer cargo antidote 1.0.0 Mutex#0..try_lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]try_lock().() {
51 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(t) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#(t)),
52 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::TryLockErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#::Poisonedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#Poisoned#(e)) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#(e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())),
53 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::TryLockErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#::WouldBlockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#WouldBlock#) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError#(())),
54 }
55 }
56
57 /// Like `std::sync::Mutex::get_mut`.
58 #[inline]
59 pub fn get_mutrust-analyzer cargo antidote 1.0.0 impl#[`Mutex<T>`]get_mut().(&mut self) -> &mut T {
60 self.0rust-analyzer cargo antidote 1.0.0 Mutex#0..get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]get_mut().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())
61 }
62 }
63
64 /// Like `std::sync::MutexGuard`.
65 #[must_use]
66 pub struct MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + 'a>(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::MutexGuardrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/MutexGuard#<'a, T>);
67
68 impl<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T> {
69 type Targetrust-analyzer cargo antidote 1.0.0 impl#[`MutexGuard<'a, T>`][Deref]Target# = T;
70
71 #[inline]
72 fn derefrust-analyzer cargo antidote 1.0.0 impl#[`MutexGuard<'a, T>`][Deref]deref().(&self) -> &T {
73 self.0rust-analyzer cargo antidote 1.0.0 MutexGuard#0..derefrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`MutexGuard<'_, T>`][Deref]deref().()
74 }
75 }
76
77 impl<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut# for MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T> {
78 #[inline]
79 fn deref_mutrust-analyzer cargo antidote 1.0.0 impl#[`MutexGuard<'a, T>`][DerefMut]deref_mut().(&mut self) -> &mut T {
80 self.0rust-analyzer cargo antidote 1.0.0 MutexGuard#0..deref_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`MutexGuard<'_, T>`][DerefMut]deref_mut().()
81 }
82 }
83
84 /// Like `std::sync::Condvar`.
85 pub struct Condvarrust-analyzer cargo antidote 1.0.0 Condvar#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Condvarrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/Condvar#);
86
87 impl Condvarrust-analyzer cargo antidote 1.0.0 Condvar# {
88 /// Like `std::sync::Condvar::new`.
89 #[inline]
90 pub fn newrust-analyzer cargo antidote 1.0.0 impl#[Condvar]new().() -> Condvarrust-analyzer cargo antidote 1.0.0 Condvar# {
91 Condvarrust-analyzer cargo antidote 1.0.0 Condvar#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Condvarrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/Condvar#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/impl#[Condvar]new().())
92 }
93
94 /// Like `std::sync::Condvar::wait`.
95 #[inline]
96 pub fn waitrust-analyzer cargo antidote 1.0.0 impl#[Condvar]wait().<'a, T>(&self, guard: MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T>) -> MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T> {
97 MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#(self.0rust-analyzer cargo antidote 1.0.0 Condvar#0..waitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/impl#[Condvar]wait().(guard.0rust-analyzer cargo antidote 1.0.0 MutexGuard#0.).unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().()))
98 }
99
100 /// Like `std::sync::Condvar::wait_timeout`.
101 #[inline]
102 pub fn wait_timeoutrust-analyzer cargo antidote 1.0.0 impl#[Condvar]wait_timeout().<'a, T>(&self,
103 guard: MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T>,
104 dur: Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#)
105 -> (MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#<'a, T>, WaitTimeoutResultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/WaitTimeoutResult#) {
106 let (guard, result) = self.0rust-analyzer cargo antidote 1.0.0 Condvar#0..wait_timeoutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/impl#[Condvar]wait_timeout().(guard.0rust-analyzer cargo antidote 1.0.0 MutexGuard#0., dur).unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().());
107 (MutexGuardrust-analyzer cargo antidote 1.0.0 MutexGuard#(guard), result)
108 }
109
110 /// Like `std::sync::Condvar::notify_one`.
111 #[inline]
112 pub fn notify_onerust-analyzer cargo antidote 1.0.0 impl#[Condvar]notify_one().(&self) {
113 self.0rust-analyzer cargo antidote 1.0.0 Condvar#0..notify_onerust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/impl#[Condvar]notify_one().()
114 }
115
116 /// Like `std::sync::Condvar::notify_all`.
117 #[inline]
118 pub fn notify_allrust-analyzer cargo antidote 1.0.0 impl#[Condvar]notify_all().(&self) {
119 self.0rust-analyzer cargo antidote 1.0.0 Condvar#0..notify_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/condvar/impl#[Condvar]notify_all().()
120 }
121 }
122
123 /// Like `std::sync::TryLockResult`.
124 pub type TryLockResultrust-analyzer cargo antidote 1.0.0 TryLockResult#<T> = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError#>;
125
126 /// Like `std::sync::TryLockError`.
127 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
128 pub struct TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError#(());
129
130 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError# {
131 fn fmtrust-analyzer cargo antidote 1.0.0 impl#[TryLockError][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
132 fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(self.descriptionrust-analyzer cargo antidote 1.0.0 impl#[TryLockError][Error]description().())
133 }
134 }
135
136 impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError# {
137 fn descriptionrust-analyzer cargo antidote 1.0.0 impl#[TryLockError][Error]description().(&self) -> &str {
138 "lock call failed because the operation would block"
139 }
140 }
141
142 /// Like `std::sync::RwLock` except that it does not poison itself.
143 pub struct RwLockrust-analyzer cargo antidote 1.0.0 RwLock#<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::RwLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/RwLock#<T>);
144
145 impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for RwLockrust-analyzer cargo antidote 1.0.0 RwLock#<T> {
146 fn fmtrust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`][Debug]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
147 fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#::fmtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`][Debug]fmt().(&self.0rust-analyzer cargo antidote 1.0.0 RwLock#0., fmt)
148 }
149 }
150
151 impl<T> RwLockrust-analyzer cargo antidote 1.0.0 RwLock#<T> {
152 /// Like `std::sync::RwLock::new`.
153 #[inline]
154 pub fn newrust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]new().(t: T) -> RwLockrust-analyzer cargo antidote 1.0.0 RwLock#<T> {
155 RwLockrust-analyzer cargo antidote 1.0.0 RwLock#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::RwLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/RwLock#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]new().(t))
156 }
157
158 /// Like `std::sync::RwLock::into_inner`.
159 #[inline]
160 pub fn into_innerrust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]into_inner().(self) -> T where T: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# {
161 self.0rust-analyzer cargo antidote 1.0.0 RwLock#0..into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]into_inner().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())
162 }
163 }
164
165 impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> RwLockrust-analyzer cargo antidote 1.0.0 RwLock#<T> {
166 /// Like `std::sync::RwLock::read`.
167 #[inline]
168 pub fn readrust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]read().<'a>(&'a self) -> RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#<'a, T> {
169 RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#(self.0rust-analyzer cargo antidote 1.0.0 RwLock#0..readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]read().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().()))
170 }
171
172 /// Like `std::sync::RwLock::try_read`.
173 #[inline]
174 pub fn try_readrust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]try_read().<'a>(&'a self) -> TryLockResultrust-analyzer cargo antidote 1.0.0 TryLockResult#<RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#<'a, T>> {
175 match self.0rust-analyzer cargo antidote 1.0.0 RwLock#0..try_readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]try_read().() {
176 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(t) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#(t)),
177 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::TryLockErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#::Poisonedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#Poisoned#(e)) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#(e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())),
178 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::TryLockErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#::WouldBlockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#WouldBlock#) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError#(())),
179 }
180 }
181
182 /// Like `std::sync::RwLock::write`.
183 #[inline]
184 pub fn writerust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]write().<'a>(&'a self) -> RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#<'a, T> {
185 RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#(self.0rust-analyzer cargo antidote 1.0.0 RwLock#0..writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]write().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().()))
186 }
187
188 /// Like `std::sync::RwLock::try_write`.
189 #[inline]
190 pub fn try_writerust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]try_write().<'a>(&'a self) -> TryLockResultrust-analyzer cargo antidote 1.0.0 TryLockResult#<RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#<'a, T>> {
191 match self.0rust-analyzer cargo antidote 1.0.0 RwLock#0..try_writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]try_write().() {
192 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(t) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#(t)),
193 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::TryLockErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#::Poisonedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#Poisoned#(e)) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#(e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())),
194 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::TryLockErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#::WouldBlockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/TryLockError#WouldBlock#) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TryLockErrorrust-analyzer cargo antidote 1.0.0 TryLockError#(())),
195 }
196 }
197
198 /// Like `std::sync::RwLock::get_mut`.
199 #[inline]
200 pub fn get_mutrust-analyzer cargo antidote 1.0.0 impl#[`RwLock<T>`]get_mut().(&mut self) -> &mut T {
201 self.0rust-analyzer cargo antidote 1.0.0 RwLock#0..get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLock<T>`]get_mut().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|e| e.into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/impl#[`PoisonError<T>`]into_inner().())
202 }
203 }
204
205 /// Like `std::sync::RwLockReadGuard`.
206 #[must_use]
207 pub struct RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + 'a>(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::RwLockReadGuardrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/RwLockReadGuard#<'a, T>);
208
209 impl<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for RwLockReadGuardrust-analyzer cargo antidote 1.0.0 RwLockReadGuard#<'a, T> {
210 type Targetrust-analyzer cargo antidote 1.0.0 impl#[`RwLockReadGuard<'a, T>`][Deref]Target# = T;
211
212 #[inline]
213 fn derefrust-analyzer cargo antidote 1.0.0 impl#[`RwLockReadGuard<'a, T>`][Deref]deref().(&self) -> &T {
214 self.0rust-analyzer cargo antidote 1.0.0 RwLockReadGuard#0..derefrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLockReadGuard<'_, T>`][Deref]deref().()
215 }
216 }
217
218 /// Like `std::sync::RwLockWriteGuard`.
219 #[must_use]
220 pub struct RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + 'a>(syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::RwLockWriteGuardrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/RwLockWriteGuard#<'a, T>);
221
222 impl<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#<'a, T> {
223 type Targetrust-analyzer cargo antidote 1.0.0 impl#[`RwLockWriteGuard<'a, T>`][Deref]Target# = T;
224
225 #[inline]
226 fn derefrust-analyzer cargo antidote 1.0.0 impl#[`RwLockWriteGuard<'a, T>`][Deref]deref().(&self) -> &T {
227 self.0rust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#0..derefrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLockWriteGuard<'_, T>`][Deref]deref().()
228 }
229 }
230
231 impl<'a, T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut# for RwLockWriteGuardrust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#<'a, T> {
232 #[inline]
233 fn deref_mutrust-analyzer cargo antidote 1.0.0 impl#[`RwLockWriteGuard<'a, T>`][DerefMut]deref_mut().(&mut self) -> &mut T {
234 self.0rust-analyzer cargo antidote 1.0.0 RwLockWriteGuard#0..deref_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/rwlock/impl#[`RwLockWriteGuard<'_, T>`][DerefMut]deref_mut().()
235 }
236 }