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/mutex.rs:21
} } impl<T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
4daeea8cad1ce8e67946bc0e17d499ab304b5ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/mutex.rs
801
860
tokio-rs/tokio:tokio/src/sync/mutex.rs:22
#[inline] pub fn mutex(this: &Self) -> &Arc<Mutex<T>> { &this.lock } } impl<T: ?Sized> Drop for OwnedMutexGuard<T> { fn drop(&mut self) { #[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { tracing::trace!( target: "runtime::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
4daeea8cad1ce8e67946bc0e17d499ab304b5ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/mutex.rs
841
900
tokio-rs/tokio:tokio/src/sync/mutex.rs:23
fmt::Display::fmt(&**self, f) } } // === impl MappedMutexGuard === impl<'a, T: ?Sized> MappedMutexGuard<'a, T> { /// Makes a new [`MappedMutexGuard`] for a component of the locked data. /// /// This operation cannot fail as the [`MappedMutexGuard`] passed in already locked the mutex. /// /// T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
4daeea8cad1ce8e67946bc0e17d499ab304b5ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/mutex.rs
881
940
tokio-rs/tokio:tokio/src/sync/mutex.rs:24
pub fn try_map<U, F>(mut this: Self, f: F) -> Result<MappedMutexGuard<'a, U>, Self> where F: FnOnce(&mut T) -> Option<&mut U>, { let data = match f(&mut *this) { Some(data) => data as *mut U, None => return Err(this), }; let s = this.s; mem::forget...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
4daeea8cad1ce8e67946bc0e17d499ab304b5ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/mutex.rs
921
968
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
/// assert_eq!(*lock, 1); /// // Release the lock. /// drop(lock); /// /// // Await the completion of the blocking task. /// blocking_task.await.unwrap(); /// /// // Assert uncontended. /// let n = mutex.try_lock().unwrap(); /// assert_eq!(*n, 2); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
/// #[tokio::main] /// async fn main() { /// let mutex = Arc::new(Mutex::new(1)); /// /// let mut n = mutex.clone().lock_owned().await; /// *n = 2; /// } /// ``` /// /// [`Arc`]: std::sync::Arc pub async fn lock_owned(self: Arc<Self>) -> OwnedMutexGuard<T> { #...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
} async fn acquire(&self) { self.s.acquire(1).await.unwrap_or_else(|_| { // The semaphore was closed. but, we never explicitly close it, and // we own it exclusively, which means that this can never happen. unreachable!() }); } /// Attempts to acquire th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
481
540
tokio-rs/tokio:tokio/src/sync/mutex.rs:14
#[cfg(all(tokio_unstable, feature = "tracing"))] resource_span: self.resource_span.clone(), }) } Err(_) => Err(TryLockError(())), } } /// Returns a mutable reference to the underlying data. /// /// Since this call borrows the `Mutex` m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
521
580
tokio-rs/tokio:tokio/src/sync/mutex.rs:15
/// /// [`TryLockError`]: TryLockError /// [`Arc`]: std::sync::Arc /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// use std::sync::Arc; /// # async fn dox() -> Result<(), tokio::sync::TryLockError> { /// /// let mutex = Arc::new(Mutex::new(1)); /// /// let n = m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
561
620
tokio-rs/tokio:tokio/src/sync/mutex.rs:16
/// Consumes the mutex, returning the underlying data. /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// /// #[tokio::main] /// async fn main() { /// let mutex = Mutex::new(1); /// /// let n = mutex.into_inner(); /// assert_eq!(n, 1); /// } /// ``...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
601
660
tokio-rs/tokio:tokio/src/sync/mutex.rs:17
{ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut d = f.debug_struct("Mutex"); match self.try_lock() { Ok(inner) => d.field("data", &&*inner), Err(_) => d.field("data", &format_args!("<locked>")), }; d.finish() } } // === impl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
641
700
tokio-rs/tokio:tokio/src/sync/mutex.rs:18
/// ``` /// /// [`MutexGuard`]: struct@MutexGuard /// [`MappedMutexGuard`]: struct@MappedMutexGuard #[inline] pub fn map<U, F>(mut this: Self, f: F) -> MappedMutexGuard<'a, U> where F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; let s = &this.lock....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
681
740
tokio-rs/tokio:tokio/src/sync/mutex.rs:19
/// let mut mapped = MutexGuard::try_map(foo.lock().await, |f| Some(&mut f.0)) /// .expect("should not fail"); /// *mapped = 2; /// } /// /// assert_eq!(Foo(2), *foo.lock().await); /// # } /// ``` /// /// [`MutexGuard`]: struct@MutexGuard /// [`MappedMutexGuard`]:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
721
780
tokio-rs/tokio:tokio/src/sync/mutex.rs:20
/// guard /// } /// # /// # #[tokio::main] /// # async fn main() { /// # let mutex = Mutex::new(0u32); /// # let guard = mutex.lock().await; /// # unlock_and_relock(guard).await; /// # } /// ``` #[inline] pub fn mutex(this: &Self) -> &'a Mutex<T> { thi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
761
820
tokio-rs/tokio:tokio/src/sync/mutex.rs:21
} impl<T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::D...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
801
860
tokio-rs/tokio:tokio/src/sync/mutex.rs:22
pub fn mutex(this: &Self) -> &Arc<Mutex<T>> { &this.lock } } impl<T: ?Sized> Drop for OwnedMutexGuard<T> { fn drop(&mut self) { #[cfg(all(tokio_unstable, feature = "tracing"))] self.resource_span.in_scope(|| { tracing::trace!( target: "runtime::resource::stat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
841
900
tokio-rs/tokio:tokio/src/sync/mutex.rs:23
} } // === impl MappedMutexGuard === impl<'a, T: ?Sized> MappedMutexGuard<'a, T> { /// Makes a new [`MappedMutexGuard`] for a component of the locked data. /// /// This operation cannot fail as the [`MappedMutexGuard`] passed in already locked the mutex. /// /// This is an associated function that...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
881
940
tokio-rs/tokio:tokio/src/sync/mutex.rs:24
where F: FnOnce(&mut T) -> Option<&mut U>, { let data = match f(&mut *this) { Some(data) => data as *mut U, None => return Err(this), }; let s = this.s; mem::forget(this); Ok(MappedMutexGuard { s, data, marke...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
5af9e0db2bfe7cba9c1e25611743724863dcbd2a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5af9e0db2bfe7cba9c1e25611743724863dcbd2a/tokio/src/sync/mutex.rs
921
967
tokio-rs/tokio:tokio/src/sync/mutex.rs:9
/// This method uses a queue to fairly distribute locks in the order they /// were requested. Cancelling a call to `lock` makes you lose your place in /// the queue. /// /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// /// #[tokio::main] /// async fn main() { /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/mutex.rs
321
380
tokio-rs/tokio:tokio/src/sync/mutex.rs:19
None => return Err(this), }; let s = &this.lock.s; mem::forget(this); Ok(MappedMutexGuard { s, data, marker: marker::PhantomData, }) } /// Returns a reference to the original `Mutex`. /// /// ``` /// use tokio::sync::{Mutex...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
4e3268d222423e874f5bbfa67e20f773da3c025f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/mutex.rs
721
780
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
/// [`MutexGuard`]: struct@MutexGuard /// [`Arc`]: struct@std::sync::Arc /// [`std::sync::Mutex`]: struct@std::sync::Mutex /// [`Send`]: trait@std::marker::Send /// [`lock`]: method@Mutex::lock pub struct Mutex<T: ?Sized> { s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. The guard ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:5
} /// A handle to a held `Mutex` that has had a function applied to it via [`MutexGuard::map`]. /// /// This can be used to hold a subfield of the protected data. /// /// [`MutexGuard::map`]: method@MutexGuard::map #[must_use = "if unused the Mutex will immediately unlock"] pub struct MappedMutexGuard<'a, T: ?Sized> {...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
161
220
tokio-rs/tokio:tokio/src/sync/mutex.rs:6
pub struct TryLockError(pub(super) ()); impl fmt::Display for TryLockError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "operation would block") } } impl Error for TryLockError {} #[test] #[cfg(not(loom))] fn bounds() { fn check_send<T: Send>() {} fn check_unpin<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
201
260
tokio-rs/tokio:tokio/src/sync/mutex.rs:7
/// use tokio::sync::Mutex; /// /// let lock = Mutex::new(5); /// ``` pub fn new(t: T) -> Self where T: Sized, { Self { c: UnsafeCell::new(t), s: semaphore::Semaphore::new(1), } } /// Creates a new lock in an unlocked state ready for use. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
241
300
tokio-rs/tokio:tokio/src/sync/mutex.rs:10
/// async fn main() { /// let mutex = Arc::new(Mutex::new(1)); /// /// let mut n = mutex.clone().lock_owned().await; /// *n = 2; /// } /// ``` /// /// [`Arc`]: std::sync::Arc pub async fn lock_owned(self: Arc<Self>) -> OwnedMutexGuard<T> { self.acquire().await; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
361
420
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
match self.s.try_acquire(1) { Ok(_) => Ok(MutexGuard { lock: self }), Err(_) => Err(TryLockError(())), } } /// Returns a mutable reference to the underlying data. /// /// Since this call borrows the `Mutex` mutably, no actual locking needs to /// take place -- the mu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
/// [`Arc`]: std::sync::Arc /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// use std::sync::Arc; /// # async fn dox() -> Result<(), tokio::sync::TryLockError> { /// /// let mutex = Arc::new(Mutex::new(1)); /// /// let n = mutex.clone().try_lock_owned()?; /// assert_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:16
}; let s = &this.lock.s; mem::forget(this); Ok(MappedMutexGuard { s, data, marker: marker::PhantomData, }) } /// Returns a reference to the original `Mutex`. /// /// ``` /// use tokio::sync::{Mutex, MutexGuard}; /// /// asy...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
601
660
tokio-rs/tokio:tokio/src/sync/mutex.rs:17
} } impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ?Sized> DerefMut for MutexGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut *self.lock.c.get() } } } impl<T: ?...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
641
700
tokio-rs/tokio:tokio/src/sync/mutex.rs:18
/// drop(guard); /// let guard = mutex.lock_owned().await; /// println!("2. contains: {:?}", *guard); /// guard /// } /// # /// # #[tokio::main] /// # async fn main() { /// # let mutex = Arc::new(Mutex::new(0u32)); /// # let guard = mutex.lock_owned().await; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
681
740
tokio-rs/tokio:tokio/src/sync/mutex.rs:19
fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized + fmt::Display> fmt::Display for OwnedMutexGuard<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self, f) } } // === impl MappedMutexGuard === impl<'a, T: ?Sized> MappedMutexGuard<'a, T> { /// Makes a new [`Ma...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
721
780
tokio-rs/tokio:tokio/src/sync/mutex.rs:20
/// /// This is an associated function that needs to be used as `MappedMutexGuard::try_map(...)`. A /// method would interfere with methods of the same name on the contents of the locked data. /// /// [`MappedMutexGuard`]: struct@MappedMutexGuard #[inline] pub fn try_map<U, F>(mut this: Self, f:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
761
814
tokio-rs/tokio:tokio/src/sync/mutex.rs:21
} } impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MappedMutexGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<'a, T: ?Sized + fmt::Display> fmt::Display for MappedMutexGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::R...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1073f6e8be93837803704e770c7c54ddb4dcde27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1073f6e8be93837803704e770c7c54ddb4dcde27/tokio/src/sync/mutex.rs
801
814
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
/// [`Arc`]: std::sync::Arc /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// use std::sync::Arc; /// # async fn dox() -> Result<(), tokio::sync::TryLockError> { /// /// let mutex = Arc::new(Mutex::new(1)); /// /// let n = mutex.clone().try_lock_owned()?; /// assert_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
7ce8f05cff4bea1379aea07fcb14f610cbc17da4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ce8f05cff4bea1379aea07fcb14f610cbc17da4/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
} } impl<T> From<T> for Mutex<T> { fn from(s: T) -> Self { Self::new(s) } } impl<T> Default for Mutex<T> where T: Default, { fn default() -> Self { Self::new(T::default()) } } impl<T> std::fmt::Debug for Mutex<T> where T: std::fmt::Debug, { fn fmt(&self, f: &mut std::fmt::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
7ce8f05cff4bea1379aea07fcb14f610cbc17da4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ce8f05cff4bea1379aea07fcb14f610cbc17da4/tokio/src/sync/mutex.rs
481
540
tokio-rs/tokio:tokio/src/sync/mutex.rs:9
/// /// ``` /// use tokio::sync::Mutex; /// use std::sync::Arc; /// /// #[tokio::main] /// async fn main() { /// let mutex = Arc::new(Mutex::new(1)); /// /// let mut n = mutex.clone().lock_owned().await; /// *n = 2; /// } /// ``` /// /// [`Arc`]: std::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
321
380
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
/// returned guard references the `Mutex` with an [`Arc`] rather than by /// borrowing it. Therefore, the `Mutex` must be wrapped in an `Arc` to call /// this method, and the guard will live for the `'static` lifetime, as it /// keeps the `Mutex` alive by holding an `Arc`. /// /// [`TryLockError`]:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
/// ``` pub fn into_inner(self) -> T where T: Sized, { self.c.into_inner() } } impl<T> From<T> for Mutex<T> { fn from(s: T) -> Self { Self::new(s) } } impl<T> Default for Mutex<T> where T: Default, { fn default() -> Self { Self::new(T::default()) } }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
impl<'a, T: ?Sized> MutexGuard<'a, T> { /// Makes a new [`MappedMutexGuard`] for a component of the locked data. /// /// This operation cannot fail as the [`MutexGuard`] passed in already locked the mutex. /// /// This is an associated function that needs to be used as `MutexGuard::map(...)`. A meth...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
481
540
tokio-rs/tokio:tokio/src/sync/mutex.rs:14
s, data, marker: marker::PhantomData, } } /// Attempts to make a new [`MappedMutexGuard`] for a component of the locked data. The /// original guard is returned if the closure returns `None`. /// /// This operation cannot fail as the [`MutexGuard`] passed in already ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
521
580
tokio-rs/tokio:tokio/src/sync/mutex.rs:15
where F: FnOnce(&mut T) -> Option<&mut U>, { let data = match f(&mut *this) { Some(data) => data as *mut U, None => return Err(this), }; let s = &this.lock.s; mem::forget(this); Ok(MappedMutexGuard { s, data, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
561
620
tokio-rs/tokio:tokio/src/sync/mutex.rs:16
} } impl<T: ?Sized> Drop for MutexGuard<'_, T> { fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ?Sized> DerefMut for MutexGuard<'_, T> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
601
660
tokio-rs/tokio:tokio/src/sync/mutex.rs:17
/// use std::sync::Arc; /// use tokio::sync::{Mutex, OwnedMutexGuard}; /// /// async fn unlock_and_relock(guard: OwnedMutexGuard<u32>) -> OwnedMutexGuard<u32> { /// println!("1. contains: {:?}", *guard); /// let mutex: Arc<Mutex<u32>> = OwnedMutexGuard::mutex(&guard).clone(); /// dro...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
641
700
tokio-rs/tokio:tokio/src/sync/mutex.rs:18
unsafe { &mut *self.lock.c.get() } } } impl<T: ?Sized + fmt::Debug> fmt::Debug for OwnedMutexGuard<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } impl<T: ?Sized + fmt::Display> fmt::Display for OwnedMutexGuard<T> { fn fmt(&self, f: &mut fmt::For...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
681
740
tokio-rs/tokio:tokio/src/sync/mutex.rs:19
} /// Attempts to make a new [`MappedMutexGuard`] for a component of the locked data. The /// original guard is returned if the closure returns `None`. /// /// This operation cannot fail as the [`MappedMutexGuard`] passed in already locked the mutex. /// /// This is an associated function that ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
721
780
tokio-rs/tokio:tokio/src/sync/mutex.rs:20
} } impl<'a, T: ?Sized> DerefMut for MappedMutexGuard<'a, T> { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut *self.data } } } impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MappedMutexGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
252004811f39c092adb04fdb177738b57c46cbe4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/252004811f39c092adb04fdb177738b57c46cbe4/tokio/src/sync/mutex.rs
761
780
tokio-rs/tokio:tokio/src/sync/mutex.rs:14
s, data, marker: marker::PhantomData, } } /// Attempts to make a new [`MappedMutexGuard`] for a component of the locked data. The /// original guard is returned if the closure returns `None`. /// /// This operation cannot fail as the [`MutexGuard`] passed in already ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
b521cc26895c6331c8ced6be72f8b3d9947a9fb3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b521cc26895c6331c8ced6be72f8b3d9947a9fb3/tokio/src/sync/mutex.rs
521
580
tokio-rs/tokio:tokio/src/sync/mutex.rs:15
where F: FnOnce(&mut T) -> Option<&mut U>, { let data = match f(&mut *this) { Some(data) => data as *mut U, None => return Err(this), }; let s = &this.lock.s; mem::forget(this); Ok(MappedMutexGuard { s, data, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
b521cc26895c6331c8ced6be72f8b3d9947a9fb3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b521cc26895c6331c8ced6be72f8b3d9947a9fb3/tokio/src/sync/mutex.rs
561
620
tokio-rs/tokio:tokio/src/sync/mutex.rs:16
} impl<T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self, f) } } // === impl OwnedMutexGuard === impl<T: ?Sized> Drop for OwnedMutexGuard<T> { fn drop(&mut self) { self.lock.s.release(1) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
b521cc26895c6331c8ced6be72f8b3d9947a9fb3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b521cc26895c6331c8ced6be72f8b3d9947a9fb3/tokio/src/sync/mutex.rs
601
660
tokio-rs/tokio:tokio/src/sync/mutex.rs:17
// === impl MappedMutexGuard === impl<'a, T: ?Sized> MappedMutexGuard<'a, T> { /// Makes a new [`MappedMutexGuard`] for a component of the locked data. /// /// This operation cannot fail as the [`MappedMutexGuard`] passed in already locked the mutex. /// /// This is an associated function that need...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
b521cc26895c6331c8ced6be72f8b3d9947a9fb3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b521cc26895c6331c8ced6be72f8b3d9947a9fb3/tokio/src/sync/mutex.rs
641
700
tokio-rs/tokio:tokio/src/sync/mutex.rs:18
{ let data = match f(&mut *this) { Some(data) => data as *mut U, None => return Err(this), }; let s = this.s; mem::forget(this); Ok(MappedMutexGuard { s, data, marker: marker::PhantomData, }) } } impl<'a, T:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
b521cc26895c6331c8ced6be72f8b3d9947a9fb3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b521cc26895c6331c8ced6be72f8b3d9947a9fb3/tokio/src/sync/mutex.rs
681
725
tokio-rs/tokio:tokio/src/sync/mutex.rs:7
/// use tokio::sync::Mutex; /// /// let lock = Mutex::new(5); /// ``` pub fn new(t: T) -> Self where T: Sized, { Self { c: UnsafeCell::new(t), s: semaphore::Semaphore::new(1), } } /// Creates a new lock in an unlocked state ready for use. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
241
300
tokio-rs/tokio:tokio/src/sync/mutex.rs:9
/// ``` /// /// [`Arc`]: std::sync::Arc pub async fn lock_owned(self: Arc<Self>) -> OwnedMutexGuard<T> { self.acquire().await; OwnedMutexGuard { lock: self } } async fn acquire(&self) { self.s.acquire(1).await.unwrap_or_else(|_| { // The semaphore was closed. but...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
321
380
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
/// # async fn dox() -> Result<(), tokio::sync::TryLockError> { /// /// let mutex = Arc::new(Mutex::new(1)); /// /// let n = mutex.clone().try_lock_owned()?; /// assert_eq!(*n, 1); /// # Ok(()) /// # } pub fn try_lock_owned(self: Arc<Self>) -> Result<OwnedMutexGuard<T>, TryLockError> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
} } impl<T> Default for Mutex<T> where T: Default, { fn default() -> Self { Self::new(T::default()) } } impl<T> std::fmt::Debug for Mutex<T> where T: std::fmt::Debug, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut d = f.debug_struct("Mutex"); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
/// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async fn main() { /// let foo = Mutex::new(Foo(1)); /// /// { /// let mut mapped = MutexGuard::map(foo.lock().await, |f| &mut f.0); /// *mapped = 2; /// } /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
481
540
tokio-rs/tokio:tokio/src/sync/mutex.rs:14
/// method would interfere with methods of the same name on the contents of the locked data. /// /// # Examples /// /// ``` /// use tokio::sync::{Mutex, MutexGuard}; /// /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] /// struct Foo(u32); /// /// # #[tokio::main] /// # async...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
521
580
tokio-rs/tokio:tokio/src/sync/mutex.rs:15
marker: marker::PhantomData, }) } } impl<T: ?Sized> Drop for MutexGuard<'_, T> { fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
561
620
tokio-rs/tokio:tokio/src/sync/mutex.rs:16
self.lock.s.release(1) } } impl<T: ?Sized> Deref for OwnedMutexGuard<T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ?Sized> DerefMut for OwnedMutexGuard<T> { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut *self.lock...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
601
660
tokio-rs/tokio:tokio/src/sync/mutex.rs:17
#[inline] pub fn map<U, F>(mut this: Self, f: F) -> MappedMutexGuard<'a, U> where F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; let s = this.s; mem::forget(this); MappedMutexGuard { s, data, marker: marker::Phan...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
641
700
tokio-rs/tokio:tokio/src/sync/mutex.rs:18
} } impl<'a, T: ?Sized> Drop for MappedMutexGuard<'a, T> { fn drop(&mut self) { self.s.release(1) } } impl<'a, T: ?Sized> Deref for MappedMutexGuard<'a, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.data } } } impl<'a, T: ?Sized> DerefMut for MappedMutex...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ba1e3c3e1a597b55998e3e99ebe98db1bb629bd/tokio/src/sync/mutex.rs
681
713
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
/// [`MutexGuard`]: struct@MutexGuard /// [`Arc`]: struct@std::sync::Arc /// [`std::sync::Mutex`]: struct@std::sync::Mutex /// [`Send`]: trait@std::marker::Send /// [`lock`]: method@Mutex::lock pub struct Mutex<T: ?Sized> { s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. The guard ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:5
} // As long as T: Send, it's fine to send and share Mutex<T> between threads. // If T was not Send, sending and sharing a Mutex<T> would be bad, since you can // access T through Mutex<T>. unsafe impl<T> Send for Mutex<T> where T: ?Sized + Send {} unsafe impl<T> Sync for Mutex<T> where T: ?Sized + Send {} unsafe impl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
161
220
tokio-rs/tokio:tokio/src/sync/mutex.rs:6
// This has to take a value, since the async fn's return type is unnameable. fn check_send_sync_val<T: Send + Sync>(_t: T) {} fn check_send_sync<T: Send + Sync>() {} fn check_static<T: 'static>() {} fn check_static_val<T: 'static>(_t: T) {} check_send::<MutexGuard<'_, u32>>(); check_send::<Owne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
201
260
tokio-rs/tokio:tokio/src/sync/mutex.rs:7
/// /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// /// static LOCK: Mutex<i32> = Mutex::const_new(5); /// ``` #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] #[cfg_attr(docsrs, doc(cfg(feature = "parking_lot")))] pub const fn const_new(t: T) -> Self wh...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
241
300
tokio-rs/tokio:tokio/src/sync/mutex.rs:10
/// } /// ``` pub fn get_mut(&mut self) -> &mut T { unsafe { // Safety: This is https://github.com/rust-lang/rust/pull/76936 &mut *self.c.get() } } /// Attempts to acquire the lock, and returns [`TryLockError`] if the lock /// is currently held somewhere else...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
361
420
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
/// Consumes the mutex, returning the underlying data. /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// /// #[tokio::main] /// async fn main() { /// let mutex = Mutex::new(1); /// /// let n = mutex.into_inner(); /// assert_eq!(n, 1); /// } /// ``...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
{ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut d = f.debug_struct("Mutex"); match self.try_lock() { Ok(inner) => d.field("data", &*inner), Err(_) => d.field("data", &format_args!("<locked>")), }; d.finish() } } // === impl ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
fmt::Display::fmt(&**self, f) } } // === impl OwnedMutexGuard === impl<T: ?Sized> Drop for OwnedMutexGuard<T> { fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for OwnedMutexGuard<T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
1a80d6eee542847c9e8399f1c6a0d495fb3817a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a80d6eee542847c9e8399f1c6a0d495fb3817a0/tokio/src/sync/mutex.rs
481
516
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
pub struct Mutex<T: ?Sized> { s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. /// /// As long as you have this guard, you have exclusive access to the underlying /// `T`. The guard internally borrows the `Mutex`, so the mutex will not be /// dropped while a guard exists. /// /// Th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:5
unsafe impl<T> Sync for Mutex<T> where T: ?Sized + Send {} unsafe impl<T> Sync for MutexGuard<'_, T> where T: ?Sized + Send + Sync {} unsafe impl<T> Sync for OwnedMutexGuard<T> where T: ?Sized + Send + Sync {} /// Error returned from the [`Mutex::try_lock`], [`RwLock::try_read`] and /// [`RwLock::try_write`] functions...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
161
220
tokio-rs/tokio:tokio/src/sync/mutex.rs:6
check_send::<MutexGuard<'_, u32>>(); check_send::<OwnedMutexGuard<u32>>(); check_unpin::<Mutex<u32>>(); check_send_sync::<Mutex<u32>>(); check_static::<OwnedMutexGuard<u32>>(); let mutex = Mutex::new(1); check_send_sync_val(mutex.lock()); let arc_mutex = Arc::new(Mutex::new(1)); check_s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
201
260
tokio-rs/tokio:tokio/src/sync/mutex.rs:7
/// static LOCK: Mutex<i32> = Mutex::const_new(5); /// ``` #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] #[cfg_attr(docsrs, doc(cfg(feature = "parking_lot")))] pub const fn const_new(t: T) -> Self where T: Sized, { Self { c: UnsafeCell::new(t), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
241
300
tokio-rs/tokio:tokio/src/sync/mutex.rs:8
/// This method is identical to [`Mutex::lock`], except that the returned /// guard references the `Mutex` with an [`Arc`] rather than by borrowing /// it. Therefore, the `Mutex` must be wrapped in an `Arc` to call this /// method, and the guard will live for the `'static` lifetime, as it keeps /// the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
281
340
tokio-rs/tokio:tokio/src/sync/mutex.rs:10
} } /// Attempts to acquire the lock, and returns [`TryLockError`] if the lock /// is currently held somewhere else. /// /// This method is identical to [`Mutex::try_lock`], except that the /// returned guard references the `Mutex` with an [`Arc`] rather than by /// borrowing it. Therefore...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
361
420
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
/// #[tokio::main] /// async fn main() { /// let mutex = Mutex::new(1); /// /// let n = mutex.into_inner(); /// assert_eq!(n, 1); /// } /// ``` pub fn into_inner(self) -> T where T: Sized, { self.c.into_inner() } } impl<T> From<T> for Mutex<T> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
}; d.finish() } } // === impl MutexGuard === impl<T: ?Sized> Drop for MutexGuard<'_, T> { fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
impl<T: ?Sized> Drop for OwnedMutexGuard<T> { fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for OwnedMutexGuard<T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ?Sized> DerefMut for OwnedMutexGuard<T> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
345b29ca11755c4dcf6c371ddfd9ce3071e60273
github
async-runtime
https://github.com/tokio-rs/tokio/blob/345b29ca11755c4dcf6c371ddfd9ce3071e60273/tokio/src/sync/mutex.rs
481
510
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. /// /// As long as you have this guard, you have exclusive access to the underlying /// `T`. The guard internally borrows the `Mutex`, so the mutex will not be /// dropped while a guard exists. /// /// The lock is automatically released w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:5
unsafe impl<T> Sync for MutexGuard<'_, T> where T: ?Sized + Send + Sync {} unsafe impl<T> Sync for OwnedMutexGuard<T> where T: ?Sized + Send + Sync {} /// Error returned from the [`Mutex::try_lock`], [`RwLock::try_read`] and /// [`RwLock::try_write`] functions. /// /// `Mutex::try_lock` operation will only fail if the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
161
220
tokio-rs/tokio:tokio/src/sync/mutex.rs:6
check_send::<OwnedMutexGuard<u32>>(); check_unpin::<Mutex<u32>>(); check_send_sync::<Mutex<u32>>(); check_static::<OwnedMutexGuard<u32>>(); let mutex = Mutex::new(1); check_send_sync_val(mutex.lock()); let arc_mutex = Arc::new(Mutex::new(1)); check_send_sync_val(arc_mutex.clone().lock_owned...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
201
260
tokio-rs/tokio:tokio/src/sync/mutex.rs:7
/// ``` #[cfg(all(feature = "parking_lot", not(all(loom, test)),))] #[cfg_attr(docsrs, doc(cfg(feature = "parking_lot")))] pub const fn const_new(t: T) -> Self where T: Sized, { Self { c: UnsafeCell::new(t), s: semaphore::Semaphore::const_new(1), } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
241
300
tokio-rs/tokio:tokio/src/sync/mutex.rs:8
/// guard references the `Mutex` with an [`Arc`] rather than by borrowing /// it. Therefore, the `Mutex` must be wrapped in an `Arc` to call this /// method, and the guard will live for the `'static` lifetime, as it keeps /// the `Mutex` alive by holding an `Arc`. /// /// # Examples /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
281
340
tokio-rs/tokio:tokio/src/sync/mutex.rs:10
} /// Attempts to acquire the lock, and returns [`TryLockError`] if the lock /// is currently held somewhere else. /// /// This method is identical to [`Mutex::try_lock`], except that the /// returned guard references the `Mutex` with an [`Arc`] rather than by /// borrowing it. Therefore, the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
361
420
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
/// async fn main() { /// let mutex = Mutex::new(1); /// /// let n = mutex.into_inner(); /// assert_eq!(n, 1); /// } /// ``` pub fn into_inner(self) -> T where T: Sized, { self.c.into_inner() } } impl<T> From<T> for Mutex<T> { fn from(s: T) -> Sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
d.finish() } } // === impl MutexGuard === impl<T: ?Sized> Drop for MutexGuard<'_, T> { fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
fn drop(&mut self) { self.lock.s.release(1) } } impl<T: ?Sized> Deref for OwnedMutexGuard<T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ?Sized> DerefMut for OwnedMutexGuard<T> { fn deref_mut(&mut self) -> &mut Self::Target { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6f8a4d7a0b4c7cb0aa8f46f844ff8a47a24bc6fd/tokio/src/sync/mutex.rs
481
509
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. /// /// As long as you have this guard, you have exclusive access to the underlying /// `T`. The guard internally borrows the `Mutex`, so the mutex will not be /// dropped while a guard exists. /// /// The lock is automatically released w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ecc32d1dca2317e555d8a6b29009cf19ef8f53e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ecc32d1dca2317e555d8a6b29009cf19ef8f53e8/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. /// /// As long as you have this guard, you have exclusive access to the underlying /// `T`. The guard internally borrows the `Mutex`, so the mutex will not be /// dropped while a guard exists. /// /// The lock is automatically released w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:5
unsafe impl<T> Sync for MutexGuard<'_, T> where T: ?Sized + Send + Sync {} unsafe impl<T> Sync for OwnedMutexGuard<T> where T: ?Sized + Send + Sync {} /// Error returned from the [`Mutex::try_lock`] function. /// /// A `try_lock` operation can only fail if the mutex is already locked. /// /// [`Mutex::try_lock`]: Mute...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
161
220
tokio-rs/tokio:tokio/src/sync/mutex.rs:6
check_static_val(arc_mutex.lock_owned()); } impl<T: ?Sized> Mutex<T> { /// Creates a new lock in an unlocked state ready for use. /// /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// /// let lock = Mutex::new(5); /// ``` pub fn new(t: T) -> Self where T: Si...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
201
260
tokio-rs/tokio:tokio/src/sync/mutex.rs:8
/// use std::sync::Arc; /// /// #[tokio::main] /// async fn main() { /// let mutex = Arc::new(Mutex::new(1)); /// /// let mut n = mutex.clone().lock_owned().await; /// *n = 2; /// } /// ``` /// /// [`Arc`]: std::sync::Arc pub async fn lock_owned(self: Arc<Self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
281
340
tokio-rs/tokio:tokio/src/sync/mutex.rs:9
/// # } /// ``` pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError> { match self.s.try_acquire(1) { Ok(_) => Ok(MutexGuard { lock: self }), Err(_) => Err(TryLockError(())), } } /// Returns a mutable reference to the underlying data. /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
321
380
tokio-rs/tokio:tokio/src/sync/mutex.rs:10
/// keeps the `Mutex` alive by holding an `Arc`. /// /// [`TryLockError`]: TryLockError /// [`Arc`]: std::sync::Arc /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// use std::sync::Arc; /// # async fn dox() -> Result<(), tokio::sync::TryLockError> { /// /// let mutex...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
361
420
tokio-rs/tokio:tokio/src/sync/mutex.rs:11
T: Sized, { self.c.into_inner() } } impl<T> From<T> for Mutex<T> { fn from(s: T) -> Self { Self::new(s) } } impl<T> Default for Mutex<T> where T: Default, { fn default() -> Self { Self::new(T::default()) } } impl<T> std::fmt::Debug for Mutex<T> where T: std::fm...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
401
460
tokio-rs/tokio:tokio/src/sync/mutex.rs:12
} } impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { unsafe { &*self.lock.c.get() } } } impl<T: ?Sized> DerefMut for MutexGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut *self.lock.c.get() } } } impl<T: ?...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
441
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:13
} } impl<T: ?Sized> DerefMut for OwnedMutexGuard<T> { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut *self.lock.c.get() } } } impl<T: ?Sized + fmt::Debug> fmt::Debug for OwnedMutexGuard<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mutex.rs
481
500
tokio-rs/tokio:tokio/src/sync/mutex.rs:4
s: semaphore::Semaphore, c: UnsafeCell<T>, } /// A handle to a held `Mutex`. /// /// As long as you have this guard, you have exclusive access to the underlying /// `T`. The guard internally borrows the `Mutex`, so the mutex will not be /// dropped while a guard exists. /// /// The lock is automatically released w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
575938d4579e6fe6a89b700aadb0ae2bbab5483b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mutex.rs
121
180
tokio-rs/tokio:tokio/src/sync/mutex.rs:5
unsafe impl<T> Sync for MutexGuard<'_, T> where T: ?Sized + Send + Sync {} unsafe impl<T> Sync for OwnedMutexGuard<T> where T: ?Sized + Send + Sync {} /// Error returned from the [`Mutex::try_lock`] function. /// /// A `try_lock` operation can only fail if the mutex is already locked. /// /// [`Mutex::try_lock`]: Mute...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
575938d4579e6fe6a89b700aadb0ae2bbab5483b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mutex.rs
161
220
tokio-rs/tokio:tokio/src/sync/mutex.rs:6
check_send_sync_val(arc_mutex.clone().lock_owned()); check_static_val(arc_mutex.lock_owned()); } impl<T: ?Sized> Mutex<T> { /// Creates a new lock in an unlocked state ready for use. /// /// # Examples /// /// ``` /// use tokio::sync::Mutex; /// /// let lock = Mutex::new(5); ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/sync/mutex.rs
MIT
575938d4579e6fe6a89b700aadb0ae2bbab5483b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mutex.rs
201
260