Consistently write RwLock

Before the documentation sometimes referred to an "rwlock" and sometimes to "`RwLock`".
This commit is contained in:
Martin Geisler 2022-09-25 20:44:42 +02:00
parent 17e8752aca
commit f67184fdcb

View File

@ -166,7 +166,7 @@ impl<T> RwLock<T> {
} }
impl<T: ?Sized> RwLock<T> { impl<T: ?Sized> RwLock<T> {
/// Locks this rwlock with shared read access, blocking the current thread /// Locks this `RwLock` with shared read access, blocking the current thread
/// until it can be acquired. /// until it can be acquired.
/// ///
/// The calling thread will be blocked until there are no more writers which /// The calling thread will be blocked until there are no more writers which
@ -180,9 +180,10 @@ impl<T: ?Sized> RwLock<T> {
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return an error if the RwLock is poisoned. An RwLock /// This function will return an error if the `RwLock` is poisoned. An
/// is poisoned whenever a writer panics while holding an exclusive lock. /// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// The failure will occur immediately after the lock has been acquired. /// lock. The failure will occur immediately after the lock has been
/// acquired.
/// ///
/// # Panics /// # Panics
/// ///
@ -214,7 +215,7 @@ impl<T: ?Sized> RwLock<T> {
} }
} }
/// Attempts to acquire this rwlock with shared read access. /// Attempts to acquire this `RwLock` with shared read access.
/// ///
/// If the access could not be granted at this time, then `Err` is returned. /// If the access could not be granted at this time, then `Err` is returned.
/// Otherwise, an RAII guard is returned which will release the shared access /// Otherwise, an RAII guard is returned which will release the shared access
@ -227,13 +228,13 @@ impl<T: ?Sized> RwLock<T> {
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return the [`Poisoned`] error if the RwLock is poisoned. /// This function will return the [`Poisoned`] error if the `RwLock` is
/// An RwLock is poisoned whenever a writer panics while holding an exclusive /// poisoned. An `RwLock` is poisoned whenever a writer panics while holding
/// lock. `Poisoned` will only be returned if the lock would have otherwise been /// an exclusive lock. `Poisoned` will only be returned if the lock would
/// acquired. /// have otherwise been acquired.
/// ///
/// This function will return the [`WouldBlock`] error if the RwLock could not /// This function will return the [`WouldBlock`] error if the `RwLock` could
/// be acquired because it was already locked exclusively. /// not be acquired because it was already locked exclusively.
/// ///
/// [`Poisoned`]: TryLockError::Poisoned /// [`Poisoned`]: TryLockError::Poisoned
/// [`WouldBlock`]: TryLockError::WouldBlock /// [`WouldBlock`]: TryLockError::WouldBlock
@ -262,20 +263,20 @@ impl<T: ?Sized> RwLock<T> {
} }
} }
/// Locks this rwlock with exclusive write access, blocking the current /// Locks this `RwLock` with exclusive write access, blocking the current
/// thread until it can be acquired. /// thread until it can be acquired.
/// ///
/// This function will not return while other writers or other readers /// This function will not return while other writers or other readers
/// currently have access to the lock. /// currently have access to the lock.
/// ///
/// Returns an RAII guard which will drop the write access of this rwlock /// Returns an RAII guard which will drop the write access of this `RwLock`
/// when dropped. /// when dropped.
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return an error if the RwLock is poisoned. An RwLock /// This function will return an error if the `RwLock` is poisoned. An
/// is poisoned whenever a writer panics while holding an exclusive lock. /// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// An error will be returned when the lock is acquired. /// lock. An error will be returned when the lock is acquired.
/// ///
/// # Panics /// # Panics
/// ///
@ -302,7 +303,7 @@ impl<T: ?Sized> RwLock<T> {
} }
} }
/// Attempts to lock this rwlock with exclusive write access. /// Attempts to lock this `RwLock` with exclusive write access.
/// ///
/// If the lock could not be acquired at this time, then `Err` is returned. /// If the lock could not be acquired at this time, then `Err` is returned.
/// Otherwise, an RAII guard is returned which will release the lock when /// Otherwise, an RAII guard is returned which will release the lock when
@ -315,13 +316,13 @@ impl<T: ?Sized> RwLock<T> {
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return the [`Poisoned`] error if the RwLock is /// This function will return the [`Poisoned`] error if the `RwLock` is
/// poisoned. An RwLock is poisoned whenever a writer panics while holding /// poisoned. An `RwLock` is poisoned whenever a writer panics while holding
/// an exclusive lock. `Poisoned` will only be returned if the lock would have /// an exclusive lock. `Poisoned` will only be returned if the lock would
/// otherwise been acquired. /// have otherwise been acquired.
/// ///
/// This function will return the [`WouldBlock`] error if the RwLock could not /// This function will return the [`WouldBlock`] error if the `RwLock` could
/// be acquired because it was already locked exclusively. /// not be acquired because it was already locked exclusively.
/// ///
/// [`Poisoned`]: TryLockError::Poisoned /// [`Poisoned`]: TryLockError::Poisoned
/// [`WouldBlock`]: TryLockError::WouldBlock /// [`WouldBlock`]: TryLockError::WouldBlock
@ -421,10 +422,10 @@ impl<T: ?Sized> RwLock<T> {
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return an error if the RwLock is poisoned. An RwLock /// This function will return an error if the `RwLock` is poisoned. An
/// is poisoned whenever a writer panics while holding an exclusive lock. An /// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// error will only be returned if the lock would have otherwise been /// lock. An error will only be returned if the lock would have otherwise
/// acquired. /// been acquired.
/// ///
/// # Examples /// # Examples
/// ///
@ -454,10 +455,10 @@ impl<T: ?Sized> RwLock<T> {
/// ///
/// # Errors /// # Errors
/// ///
/// This function will return an error if the RwLock is poisoned. An RwLock /// This function will return an error if the `RwLock` is poisoned. An
/// is poisoned whenever a writer panics while holding an exclusive lock. An /// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// error will only be returned if the lock would have otherwise been /// lock. An error will only be returned if the lock would have otherwise
/// acquired. /// been acquired.
/// ///
/// # Examples /// # Examples
/// ///