id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:5
/// /// **Note:** This won't *necessarily* allow any additional readers to acquire /// locks, since [`RwLock`] is fair and it is possible that a writer is next /// in line. /// /// Returns an RAII guard which will drop this read access of the `RwLock` /// when dropped. /// /// # Examples...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:6
#[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::state_update", write_locked = false, write_locked.op = "override", ) }); #[cfg(all(tokio_unstable, feature =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard.rs
201
260
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:7
impl<T: ?Sized> ops::DerefMut for OwnedRwLockWriteGuard<T> { fn deref_mut(&mut self) -> &mut T { unsafe { &mut *self.data } } } impl<T: ?Sized> fmt::Debug for OwnedRwLockWriteGuard<T> where T: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard.rs
241
279
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:1
use crate::sync::rwlock::owned_read_guard::OwnedRwLockReadGuard; use crate::sync::rwlock::owned_write_guard_mapped::OwnedRwLockMappedWriteGuard; use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:2
/// use tokio::sync::{RwLock, OwnedRwLockWriteGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let lock = Arc::clone(&lock); /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:3
/// This operation cannot fail as the `OwnedRwLockWriteGuard` passed in /// already locked the data. /// /// This is an associated function that needs to be /// used as `OwnedRwLockWriteGuard::try_map(...)`. A method would interfere /// with methods of the same name on the contents of the locked dat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:4
Some(data) => data as *mut U, None => return Err(this), }; let permits_acquired = this.permits_acquired; let lock = unsafe { ManuallyDrop::take(&mut this.lock) }; // NB: Forget to avoid drop impl from being called. mem::forget(this); Ok(OwnedRwLockMappedWriteG...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:5
/// # /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(1)); /// /// let n = lock.clone().write_owned().await; /// /// let cloned_lock = lock.clone(); /// let handle = tokio::spawn(async move { /// *cloned_lock.write_owned().await = 2; /// }); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:6
unsafe { &*self.data } } } impl<T: ?Sized> ops::DerefMut for OwnedRwLockWriteGuard<T> { fn deref_mut(&mut self) -> &mut T { unsafe { &mut *self.data } } } impl<T: ?Sized> fmt::Debug for OwnedRwLockWriteGuard<T> where T: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard.rs
201
234
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:1
use crate::sync::rwlock::owned_read_guard::OwnedRwLockReadGuard; use crate::sync::rwlock::owned_write_guard_mapped::OwnedRwLockMappedWriteGuard; use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
e89c8981f151a667bb676213d38b7dbeb51620e9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e89c8981f151a667bb676213d38b7dbeb51620e9/tokio/src/sync/rwlock/owned_write_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:1
use crate::sync::rwlock::owned_read_guard::OwnedRwLockReadGuard; use crate::sync::rwlock::owned_write_guard_mapped::OwnedRwLockMappedWriteGuard; use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:2
/// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let lock = Arc::clone(&lock); /// let mut mapped = OwnedRwLockWriteGuard::map(lock.write_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:3
/// This is an associated function that needs to be /// used as `OwnedRwLockWriteGuard::try_map(...)`. A method would interfere /// with methods of the same name on the contents of the locked data. /// /// [`RwLockMappedWriteGuard`]: struct@crate::sync::RwLockMappedWriteGuard /// /// # Examples ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:4
let lock = unsafe { ManuallyDrop::take(&mut this.lock) }; // NB: Forget to avoid drop impl from being called. mem::forget(this); Ok(OwnedRwLockMappedWriteGuard { lock: ManuallyDrop::new(lock), data, _p: PhantomData, }) } /// Converts this `Own...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:5
/// let n = lock.clone().write_owned().await; /// /// let cloned_lock = lock.clone(); /// let handle = tokio::spawn(async move { /// *cloned_lock.write_owned().await = 2; /// }); /// /// let n = n.downgrade(); /// assert_eq!(*n, 1, "downgrade is atomic"); /// /// drop(n); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard.rs:6
fn deref_mut(&mut self) -> &mut T { unsafe { &mut *self.data } } } impl<T: ?Sized> fmt::Debug for OwnedRwLockWriteGuard<T> where T: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized> fmt::Display for OwnedRwLockWrite...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard.rs
201
229
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:1
use crate::sync::rwlock::RwLock; use std::marker::PhantomData; use std::sync::Arc; use std::{fmt, mem, ops, ptr}; /// Owned RAII structure used to release the exclusive write access of a lock when /// dropped. /// /// This structure is created by [mapping] an [`OwnedRwLockWriteGuard`]. It is a /// separate type from `...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:2
unsafe { Inner { #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: ptr::read(&me.resource_span), permits_acquired: me.permits_acquired, lock: ptr::read(&me.lock), data: me.data, } } } /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:3
/// assert_eq!(Foo(2), *lock.read().await); /// # } /// ``` #[inline] pub fn map<F, V: ?Sized>(mut this: Self, f: F) -> OwnedRwLockMappedWriteGuard<T, V> where F: FnOnce(&mut U) -> &mut V, { let data = f(&mut *this) as *mut V; let this = this.skip_drop(); OwnedRw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
/// /// # #[tokio::main(flavor = "current_thread")] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let guard = Arc::clone(&lock).write_owned().await; /// let mut guard = OwnedRwLockWriteGuard::try_map(guard, |f| Some(&mut f.0)).expect("should not ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:5
/// # Examples /// /// ``` /// use std::sync::Arc; /// use tokio::sync::{ /// RwLock, /// OwnedRwLockWriteGuard, /// OwnedRwLockMappedWriteGuard, /// }; /// /// # #[tokio::main(flavor = "current_thread")] /// # async fn main() { /// let lock = Arc::new(RwLock:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:6
U: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized, U: ?Sized> fmt::Display for OwnedRwLockMappedWriteGuard<T, U> where U: fmt::Display, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
201
230
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:2
unsafe { Inner { #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: ptr::read(&me.resource_span), permits_acquired: me.permits_acquired, lock: ptr::read(&me.lock), data: me.data, } } } /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4565b81097e8938761431592c0ad36df3bd20cd2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4565b81097e8938761431592c0ad36df3bd20cd2/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:3
/// assert_eq!(Foo(2), *lock.read().await); /// # } /// ``` #[inline] pub fn map<F, V: ?Sized>(mut this: Self, f: F) -> OwnedRwLockMappedWriteGuard<T, V> where F: FnOnce(&mut U) -> &mut V, { let data = f(&mut *this) as *mut V; let this = this.skip_drop(); OwnedRw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4565b81097e8938761431592c0ad36df3bd20cd2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4565b81097e8938761431592c0ad36df3bd20cd2/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
/// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let guard = Arc::clone(&lock).write_owned().await; /// let mut guard = OwnedRwLockWriteGuard::try_map(guard, |f| Some(&mut f.0)).expect("should not fail"); /// *guard ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4565b81097e8938761431592c0ad36df3bd20cd2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4565b81097e8938761431592c0ad36df3bd20cd2/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:5
/// # Examples /// /// ``` /// use std::sync::Arc; /// use tokio::sync::{ /// RwLock, /// OwnedRwLockWriteGuard, /// OwnedRwLockMappedWriteGuard, /// }; /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(1)); /// /// l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4565b81097e8938761431592c0ad36df3bd20cd2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4565b81097e8938761431592c0ad36df3bd20cd2/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
/// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let guard = Arc::clone(&lock).write_owned().await; /// let mut guard = OwnedRwLockWriteGuard::try_map(guard, |f| Some(&mut f.0)).expect("should not fail"); /// *guard ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:5
type Target = U; fn deref(&self) -> &U { unsafe { &*self.data } } } impl<T: ?Sized, U: ?Sized> ops::DerefMut for OwnedRwLockMappedWriteGuard<T, U> { fn deref_mut(&mut self) -> &mut U { unsafe { &mut *self.data } } } impl<T: ?Sized, U: ?Sized> fmt::Debug for OwnedRwLockMappedWriteGuard...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
161
205
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:1
use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure used to release the exclusive write access of a lock when /// dropped. /// /// This structure is created by [mapping] an [`OwnedRwLockWriteGuard`]....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:2
/// ``` /// use std::sync::Arc; /// use tokio::sync::{RwLock, OwnedRwLockWriteGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:3
} } /// Attempts to make a new `OwnedRwLockMappedWriteGuard` for a component /// of the locked data. The original guard is returned if the closure /// returns `None`. /// /// This operation cannot fail as the `OwnedRwLockMappedWriteGuard` passed /// in already locked the data. /// /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
) -> Result<OwnedRwLockMappedWriteGuard<T, V>, Self> where F: FnOnce(&mut U) -> Option<&mut V>, { let data = match f(&mut *this) { Some(data) => data as *mut V, None => return Err(this), }; let lock = unsafe { ManuallyDrop::take(&mut this.lock) }; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:5
impl<T: ?Sized, U: ?Sized> fmt::Debug for OwnedRwLockMappedWriteGuard<T, U> where U: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized, U: ?Sized> fmt::Display for OwnedRwLockMappedWriteGuard<T, U> where U: fmt::Display, { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
161
192
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:1
use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure used to release the exclusive write access of a lock when /// dropped. /// /// This structure is created by [mapping] an [`OwnedRwLockWriteGuard`]....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:2
/// use std::sync::Arc; /// use tokio::sync::{RwLock, OwnedRwLockWriteGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let lock = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:3
} /// Attempts to make a new `OwnedRwLockMappedWriteGuard` for a component /// of the locked data. The original guard is returned if the closure /// returns `None`. /// /// This operation cannot fail as the `OwnedRwLockMappedWriteGuard` passed /// in already locked the data. /// /// Thi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
where F: FnOnce(&mut U) -> Option<&mut V>, { let data = match f(&mut *this) { Some(data) => data as *mut V, None => return Err(this), }; let lock = unsafe { ManuallyDrop::take(&mut this.lock) }; let permits_acquired = this.permits_acquired; #[c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:5
where U: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized, U: ?Sized> fmt::Display for OwnedRwLockMappedWriteGuard<T, U> where U: fmt::Display, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Di...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
161
191
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:1
use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure used to release the exclusive write access of a lock when /// dropped. /// /// This structure is created by [mapping] an [`OwnedRwLockWriteGuard`]....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:2
/// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let lock = Arc::clone(&lock); /// let mut mapped = OwnedRwLockWriteGuard::map(lock.write_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:3
/// in already locked the data. /// /// This is an associated function that needs to be /// used as `OwnedRwLockMappedWriteGuard::try_map(...)`. A method would interfere with /// methods of the same name on the contents of the locked data. /// /// # Examples /// /// ``` /// use std::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
let lock = unsafe { ManuallyDrop::take(&mut this.lock) }; let permits_acquired = this.permits_acquired; // NB: Forget to avoid drop impl from being called. mem::forget(this); Ok(OwnedRwLockMappedWriteGuard { permits_acquired, lock: ManuallyDrop::new(lock), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
171
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:5
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self, f) } } impl<T: ?Sized, U: ?Sized> Drop for OwnedRwLockMappedWriteGuard<T, U> { fn drop(&mut self) { self.lock.s.release(self.permits_acquired as usize); unsafe { ManuallyDrop::drop(&mut self.lock) }; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
161
171
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:1
use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure used to release the exclusive write access of a lock when /// dropped. /// /// This structure is created by [mapping] an [`OwnedRwLockWriteGuard`]....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
e89c8981f151a667bb676213d38b7dbeb51620e9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e89c8981f151a667bb676213d38b7dbeb51620e9/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:1
use crate::sync::rwlock::RwLock; use std::fmt; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::ops; use std::sync::Arc; /// Owned RAII structure used to release the exclusive write access of a lock when /// dropped. /// /// This structure is created by [mapping] an [`OwnedRwLockWriteGuard`]....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:2
/// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = Arc::new(RwLock::new(Foo(1))); /// /// { /// let lock = Arc::clone(&lock); /// let mut mapped = OwnedRwLockWriteGuard::map(lock.write_owned()....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:3
/// used as `OwnedRwLockMappedWriteGuard::try_map(...)`. A method would interfere with /// methods of the same name on the contents of the locked data. /// /// # Examples /// /// ``` /// use std::sync::Arc; /// use tokio::sync::{RwLock, OwnedRwLockWriteGuard}; /// /// #[derive(Debug,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/owned_write_guard_mapped.rs:4
Ok(OwnedRwLockMappedWriteGuard { lock: ManuallyDrop::new(lock), data, _p: PhantomData, }) } } impl<T: ?Sized, U: ?Sized> ops::Deref for OwnedRwLockMappedWriteGuard<T, U> { type Target = U; fn deref(&self) -> &U { unsafe { &*self.data } } } impl<T: ?...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/owned_write_guard_mapped.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/owned_write_guard_mapped.rs
121
166
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::marker::PhantomData; use std::{fmt, mem, ops}; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read /// [...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:2
s: me.s, data: me.data, } } /// Makes a new `RwLockReadGuard` for a component of the locked data. /// /// This operation cannot fail as the `RwLockReadGuard` passed in already /// locked the data. /// /// This is an associated function that needs to be /// used as `R...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/read_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:3
where F: FnOnce(&T) -> &U, { let data = f(&*this) as *const U; let this = this.skip_drop(); RwLockReadGuard { s: this.s, data, marker: PhantomData, #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: this.resour...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/read_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:4
/// # #[tokio::main(flavor = "current_thread")] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// let guard = lock.read().await; /// let guard = RwLockReadGuard::try_map(guard, |f| Some(&f.0)).expect("should not fail"); /// /// assert_eq!(1, *guard); /// # } /// ```...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/read_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:5
where T: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<'a, T: ?Sized> fmt::Display for RwLockReadGuard<'a, T> where T: fmt::Display, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/read_guard.rs
161
191
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:2
s: me.s, data: me.data, } } /// Makes a new `RwLockReadGuard` for a component of the locked data. /// /// This operation cannot fail as the `RwLockReadGuard` passed in already /// locked the data. /// /// This is an associated function that needs to be /// used as `R...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/read_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:3
where F: FnOnce(&T) -> &U, { let data = f(&*this) as *const U; let this = this.skip_drop(); RwLockReadGuard { s: this.s, data, marker: PhantomData, #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: this.resour...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/read_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:4
/// # #[tokio::main] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// let guard = lock.read().await; /// let guard = RwLockReadGuard::try_map(guard, |f| Some(&f.0)).expect("should not fail"); /// /// assert_eq!(1, *guard); /// # } /// ``` #[inline] pub fn t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/read_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::fmt; use std::marker; use std::mem; use std::ops; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:2
/// # Examples /// /// ``` /// use tokio::sync::{RwLock, RwLockReadGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// let guard = lock.read().await;...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/read_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:3
/// locked data. The original guard is returned if the closure returns /// `None`. /// /// This operation cannot fail as the `RwLockReadGuard` passed in already /// locked the data. /// /// This is an associated function that needs to be used as /// `RwLockReadGuard::try_map(..)`. A method w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/read_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:4
Some(data) => data as *const U, None => return Err(this), }; let s = this.s; #[cfg(all(tokio_unstable, feature = "tracing"))] let resource_span = this.resource_span.clone(); // NB: Forget to avoid drop impl from being called. mem::forget(this); Ok(RwL...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/read_guard.rs
121
179
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:5
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self, f) } } impl<'a, T: ?Sized> Drop for RwLockReadGuard<'a, T> { fn drop(&mut self) { self.s.release(1); #[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
d6dbefcdc043da552615bf2c8ad1f3a9580a1735
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d6dbefcdc043da552615bf2c8ad1f3a9580a1735/tokio/src/sync/rwlock/read_guard.rs
161
179
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::fmt; use std::marker; use std::mem; use std::ops; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:2
/// /// ``` /// use tokio::sync::{RwLock, RwLockReadGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// let guard = lock.read().await; /// let guard ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4/tokio/src/sync/rwlock/read_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:3
/// `None`. /// /// This operation cannot fail as the `RwLockReadGuard` passed in already /// locked the data. /// /// This is an associated function that needs to be used as /// `RwLockReadGuard::try_map(..)`. A method would interfere with methods of the /// same name on the contents of the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4/tokio/src/sync/rwlock/read_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:4
None => return Err(this), }; let s = this.s; #[cfg(all(tokio_unstable, feature = "tracing"))] let resource_span = this.resource_span.clone(); // NB: Forget to avoid drop impl from being called. mem::forget(this); Ok(RwLockReadGuard { s, da...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4/tokio/src/sync/rwlock/read_guard.rs
121
178
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:5
fmt::Display::fmt(&**self, f) } } impl<'a, T: ?Sized> Drop for RwLockReadGuard<'a, T> { fn drop(&mut self) { self.s.release(1); #[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::state_u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4/tokio/src/sync/rwlock/read_guard.rs
161
178
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::fmt; use std::marker; use std::mem; use std::ops; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:2
/// ``` /// use tokio::sync::{RwLock, RwLockReadGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// let guard = lock.read().await; /// let guard = RwLock...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/read_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:3
/// /// This operation cannot fail as the `RwLockReadGuard` passed in already /// locked the data. /// /// This is an associated function that needs to be used as /// `RwLockReadGuard::try_map(..)`. A method would interfere with methods of the /// same name on the contents of the locked data. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/read_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:4
}; let s = this.s; #[cfg(all(tokio_unstable, feature = "tracing"))] let resource_span = this.resource_span.clone(); // NB: Forget to avoid drop impl from being called. mem::forget(this); Ok(RwLockReadGuard { s, data, marker: marker::Ph...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/read_guard.rs
121
177
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:5
} } impl<'a, T: ?Sized> Drop for RwLockReadGuard<'a, T> { fn drop(&mut self) { self.s.release(1); #[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::state_update", current_reader...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/rwlock/read_guard.rs
161
177
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::fmt; use std::marker; use std::mem; use std::ops; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:2
/// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// let guard = lock.read().await; /// let guard = RwLockReadGuard::map(guard, |f| &f.0); /// /// assert_eq!(1, *...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/read_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:3
/// /// This is an asynchronous version of [`RwLockReadGuard::try_map`] from the /// [`parking_lot` crate]. /// /// [`RwLockReadGuard::try_map`]: https://docs.rs/lock_api/latest/lock_api/struct.RwLockReadGuard.html#method.try_map /// [`parking_lot` crate]: https://crates.io/crates/parking_lot //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/read_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:4
marker: marker::PhantomData, }) } } impl<T: ?Sized> ops::Deref for RwLockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &T { unsafe { &*self.data } } } impl<'a, T: ?Sized> fmt::Debug for RwLockReadGuard<'a, T> where T: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/rwlock/read_guard.rs
121
156
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::fmt; use std::marker; use std::mem; use std::ops; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
0dc4769708279a076e01a66dc53ec226083c1bdb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc4769708279a076e01a66dc53ec226083c1bdb/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/read_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use std::fmt; use std::marker; use std::mem; use std::ops; /// RAII structure used to release the shared read access of a lock when /// dropped. /// /// This structure is created by the [`read`] method on /// [`RwLock`]. /// /// [`read`]: method@crate::sync::RwLock::read //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/read_guard.rs
MIT
e3f2dcf5bc8315f01c8843259e78c8e98203a978
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3f2dcf5bc8315f01c8843259e78c8e98203a978/tokio/src/sync/rwlock/read_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:1
use crate::sync::batch_semaphore::Semaphore; use crate::sync::rwlock::read_guard::RwLockReadGuard; use crate::sync::rwlock::write_guard_mapped::RwLockMappedWriteGuard; use std::marker::PhantomData; use std::{fmt, mem, ops}; /// RAII structure used to release the exclusive write access of a lock when /// dropped. /// /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
1
60
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:2
// forgets the originals, so in the end no value is duplicated. Inner { #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: unsafe { std::ptr::read(&me.resource_span) }, permits_acquired: me.permits_acquired, s: me.s, data: me.data, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:3
/// *mapped = 2; /// } /// /// assert_eq!(Foo(2), *lock.read().await); /// # } /// ``` #[inline] pub fn map<F, U: ?Sized>(mut this: Self, f: F) -> RwLockMappedWriteGuard<'a, U> where F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; let th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:4
/// [`RwLockWriteGuard::map`]: https://docs.rs/lock_api/latest/lock_api/struct.RwLockWriteGuard.html#method.map /// [`RwLockWriteGuard::downgrade`]: https://docs.rs/lock_api/latest/lock_api/struct.RwLockWriteGuard.html#method.downgrade /// [`parking_lot` crate]: https://crates.io/crates/parking_lot /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:5
#[cfg(all(tokio_unstable, feature = "tracing"))] guard.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::state_update", write_locked = false, write_locked.op = "override", ) }); #[cfg(all(tokio_unstable, feature ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:6
/// /// ``` /// use tokio::sync::{RwLock, RwLockWriteGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main(flavor = "current_thread")] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// { /// let gua...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
201
260
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:7
resource_span: this.resource_span, }) } /// Attempts to make a new [`RwLockReadGuard`] for a component of /// the locked data. The original guard is returned if the closure returns /// `None`. /// /// This operation cannot fail as the `RwLockWriteGuard` passed in already /// locked ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
241
300
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:8
/// let guard = RwLockWriteGuard::try_downgrade_map(lock.write().await, |f| Some(&f.0)).expect("should not fail"); /// let foo = lock.read().await; /// assert_eq!(foo.0, *guard); /// # } /// ``` #[inline] pub fn try_downgrade_map<F, U: ?Sized>(this: Self, f: F) -> Result<RwLockReadGuard<'a, U>, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
281
340
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:9
current_readers = 1, current_readers.op = "add", ) }); Ok(guard) } /// Converts this `RwLockWriteGuard` into an `RwLockMappedWriteGuard`. This /// method can be used to store a non-mapped guard in a struct field that /// expects a mapped guard. /// /// T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
321
380
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:10
/// let cloned_lock = lock.clone(); /// let handle = tokio::spawn(async move { /// *cloned_lock.write().await = 2; /// }); /// /// let n = n.downgrade(); /// assert_eq!(*n, 1, "downgrade is atomic"); /// /// drop(n); /// handle.await.unwrap(); /// assert_eq!(*lock.read().awai...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
361
420
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:11
tracing::trace!( target: "runtime::resource::state_update", current_readers = 1, current_readers.op = "add", ) }); guard } } impl<T: ?Sized> ops::Deref for RwLockWriteGuard<'_, T> { type Target = T; fn deref(&self) -> &T { unsafe { &...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
401
457
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:12
} } impl<'a, T: ?Sized> Drop for RwLockWriteGuard<'a, T> { fn drop(&mut self) { self.s.release(self.permits_acquired as usize); #[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::state_updat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/rwlock/write_guard.rs
441
457
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:2
// forgets the originals, so in the end no value is duplicated. Inner { #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: unsafe { std::ptr::read(&me.resource_span) }, permits_acquired: me.permits_acquired, s: me.s, data: me.data, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
41
100
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:3
/// *mapped = 2; /// } /// /// assert_eq!(Foo(2), *lock.read().await); /// # } /// ``` #[inline] pub fn map<F, U: ?Sized>(mut this: Self, f: F) -> RwLockMappedWriteGuard<'a, U> where F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; let th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:4
/// [`RwLockWriteGuard::map`]: https://docs.rs/lock_api/latest/lock_api/struct.RwLockWriteGuard.html#method.map /// [`RwLockWriteGuard::downgrade`]: https://docs.rs/lock_api/latest/lock_api/struct.RwLockWriteGuard.html#method.downgrade /// [`parking_lot` crate]: https://crates.io/crates/parking_lot /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:5
#[cfg(all(tokio_unstable, feature = "tracing"))] guard.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::state_update", write_locked = false, write_locked.op = "override", ) }); #[cfg(all(tokio_unstable, feature ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:6
/// /// ``` /// use tokio::sync::{RwLock, RwLockWriteGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let lock = RwLock::new(Foo(1)); /// /// { /// let guard = lock.write().await; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
201
260
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:7
resource_span: this.resource_span, }) } /// Attempts to make a new [`RwLockReadGuard`] for a component of /// the locked data. The original guard is returned if the closure returns /// `None`. /// /// This operation cannot fail as the `RwLockWriteGuard` passed in already /// locked ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
241
300
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:9
current_readers = 1, current_readers.op = "add", ) }); Ok(guard) } /// Converts this `RwLockWriteGuard` into an `RwLockMappedWriteGuard`. This /// method can be used to store a non-mapped guard in a struct field that /// expects a mapped guard. /// /// T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
002f4a28c882d127a665bb8d71f751d4eb5e1b22
github
async-runtime
https://github.com/tokio-rs/tokio/blob/002f4a28c882d127a665bb8d71f751d4eb5e1b22/tokio/src/sync/rwlock/write_guard.rs
321
380
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:3
/// *mapped = 2; /// } /// /// assert_eq!(Foo(2), *lock.read().await); /// # } /// ``` #[inline] pub fn map<F, U: ?Sized>(mut this: Self, f: F) -> RwLockMappedWriteGuard<'a, U> where F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; let th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/write_guard.rs
81
140
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:4
/// [`parking_lot` crate]: https://crates.io/crates/parking_lot /// /// # Examples /// /// ``` /// use tokio::sync::{RwLock, RwLockWriteGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/write_guard.rs
121
180
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:5
data, marker: PhantomData, #[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: this.resource_span, }) } /// Converts this `RwLockWriteGuard` into an `RwLockMappedWriteGuard`. This /// method can be used to store a non-mapped guard in a struct field th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/write_guard.rs
161
220
tokio-rs/tokio:tokio/src/sync/rwlock/write_guard.rs:6
/// let handle = tokio::spawn(async move { /// *cloned_lock.write().await = 2; /// }); /// /// let n = n.downgrade(); /// assert_eq!(*n, 1, "downgrade is atomic"); /// /// drop(n); /// handle.await.unwrap(); /// assert_eq!(*lock.read().await, 2, "second writer obtained write lock...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/rwlock/write_guard.rs
MIT
24aac0add3547803b571e9d5c6d6c3ecbd09bb5b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24aac0add3547803b571e9d5c6d6c3ecbd09bb5b/tokio/src/sync/rwlock/write_guard.rs
201
260