We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1bfc6c1 commit 0855ea1Copy full SHA for 0855ea1
src/libstd/sync/rwlock.rs
@@ -457,6 +457,17 @@ impl<T: Default> Default for RwLock<T> {
457
}
458
459
460
+#[stable(feature = "rw_lock_from", since = "1.22.0")]
461
+impl<T> From<T> for RwLock<T> {
462
+ /// Creates a new instance of an `RwLock<T>` which is unlocked.
463
+ /// This is equivalent to [`RwLock::new`].
464
+ ///
465
+ /// [`RwLock::new`]: #method.new
466
+ fn from(t: T) -> Self {
467
+ RwLock::new(t)
468
+ }
469
+}
470
+
471
impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
472
unsafe fn new(lock: &'rwlock RwLock<T>)
473
-> LockResult<RwLockReadGuard<'rwlock, T>> {
0 commit comments