Skip to content

Commit 23d95da

Browse files
committed
build(deps): optionally use parking_lot for sync primitives
1 parent 64075db commit 23d95da

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ system-proxy = ["dep:system-configuration", "dep:windows-registry"]
6666
# Enable tracing logging.
6767
tracing = ["http2/tracing", "dep:tracing"]
6868

69+
# Enable http2 parking_lot feature.
70+
parking_lot = ["http2/parking_lot"]
71+
6972
[dependencies]
7073
base64 = "0.22"
7174
url = "2.5.4"
@@ -79,7 +82,7 @@ tower = { version = "0.5.2", default-features = false, features = [
7982
] }
8083
bytes = "1.10.1"
8184
http = "1.3.1"
82-
http2 = { version = "0.5.7", features = ["unstable"] }
85+
http2 = { version = "0.5.8", features = ["unstable"] }
8386
httparse = "1.10.1"
8487
http-body = "1.0.1"
8588
http-body-util = "0.1.3"

src/sync.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ use std::{
1212
sync,
1313
};
1414

15-
/// A `Mutex` that never poisons and has the same interface as `std::sync::Mutex`.
16-
///
17-
/// See [`crate::sync`] for more details.
15+
/// A `Mutex` that never poisons and has the same interface as [`std::sync::Mutex`].
1816
pub struct Mutex<T: ?Sized>(sync::Mutex<T>);
1917

2018
impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
@@ -24,22 +22,22 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
2422
}
2523

2624
impl<T> Mutex<T> {
27-
/// Like `std::sync::Mutex::new`.
25+
/// Like [`std::sync::Mutex::new`].
2826
#[inline]
2927
pub fn new(t: T) -> Mutex<T> {
3028
Mutex(sync::Mutex::new(t))
3129
}
3230
}
3331

3432
impl<T: ?Sized> Mutex<T> {
35-
/// Like `std::sync::Mutex::lock`.
33+
/// Like [`std::sync::Mutex::lock`].
3634
#[inline]
3735
pub fn lock(&self) -> MutexGuard<'_, T> {
3836
MutexGuard(self.0.lock().unwrap_or_else(|e| e.into_inner()))
3937
}
4038
}
4139

42-
/// Like `std::sync::MutexGuard`.
40+
/// Like [`std::sync::MutexGuard`].
4341
#[must_use]
4442
pub struct MutexGuard<'a, T: ?Sized + 'a>(sync::MutexGuard<'a, T>);
4543

@@ -59,9 +57,7 @@ impl<T: ?Sized> DerefMut for MutexGuard<'_, T> {
5957
}
6058
}
6159

62-
/// A `RwLock` that never poisons and has the same interface as `std::sync::RwLock`.
63-
///
64-
/// See [`crate::sync`] for more details.
60+
/// A `RwLock` that never poisons and has the same interface as [`std::sync::RwLock`].
6561
pub struct RwLock<T: ?Sized>(sync::RwLock<T>);
6662

6763
impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
@@ -71,28 +67,28 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
7167
}
7268

7369
impl<T> RwLock<T> {
74-
/// Like `std::sync::RwLock::new`.
70+
/// Like [`std::sync::RwLock::new`].
7571
#[inline]
7672
pub fn new(t: T) -> RwLock<T> {
7773
RwLock(sync::RwLock::new(t))
7874
}
7975
}
8076

8177
impl<T: ?Sized> RwLock<T> {
82-
/// Like `std::sync::RwLock::read`.
78+
/// Like [`std::sync::RwLock::read`].
8379
#[inline]
8480
pub fn read(&self) -> RwLockReadGuard<'_, T> {
8581
RwLockReadGuard(self.0.read().unwrap_or_else(|e| e.into_inner()))
8682
}
8783

88-
/// Like `std::sync::RwLock::write`.
84+
/// Like [`std::sync::RwLock::write`].
8985
#[inline]
9086
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
9187
RwLockWriteGuard(self.0.write().unwrap_or_else(|e| e.into_inner()))
9288
}
9389
}
9490

95-
/// Like `std::sync::RwLockReadGuard`.
91+
/// Like [`std::sync::RwLockReadGuard`].
9692
#[must_use]
9793
pub struct RwLockReadGuard<'a, T: ?Sized + 'a>(sync::RwLockReadGuard<'a, T>);
9894

@@ -105,7 +101,7 @@ impl<T: ?Sized> Deref for RwLockReadGuard<'_, T> {
105101
}
106102
}
107103

108-
/// Like `std::sync::RwLockWriteGuard`.
104+
/// Like [`std::sync::RwLockWriteGuard`].
109105
#[must_use]
110106
pub struct RwLockWriteGuard<'a, T: ?Sized + 'a>(sync::RwLockWriteGuard<'a, T>);
111107

0 commit comments

Comments
 (0)