summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync/rwlock.rs
diff options
context:
space:
mode:
authorDaniel Müller <d-e-s-o@users.noreply.github.com>2020-03-18 11:52:11 -0700
committerGitHub <noreply@github.com>2020-03-18 11:52:11 -0700
commitc3b830110aa3f13346721dc148e074c122c7ddbe (patch)
tree26c9b9b08fcf564f6b2c1f28cddbf45cc8736809 /tokio/src/sync/rwlock.rs
parent602ad2e0ba41467f08052e152d5808ee6a695afe (diff)
sync: Add RwLock::into_inner method (#2321)
Add RwLock::into_inner method that consumes the lock and returns the wrapped value. Fixes: #2320
Diffstat (limited to 'tokio/src/sync/rwlock.rs')
-rw-r--r--tokio/src/sync/rwlock.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tokio/src/sync/rwlock.rs b/tokio/src/sync/rwlock.rs
index ccd0e884..97921b9f 100644
--- a/tokio/src/sync/rwlock.rs
+++ b/tokio/src/sync/rwlock.rs
@@ -244,6 +244,11 @@ impl<T> RwLock<T> {
RwLockWriteGuard { lock: self, permit }
}
+
+ /// Consumes the lock, returning the underlying data.
+ pub fn into_inner(self) -> T {
+ self.c.into_inner()
+ }
}
impl<T> ops::Deref for RwLockReadGuard<'_, T> {