aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/cell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/cell.rs')
-rw-r--r--components/script/dom/bindings/cell.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index df0ca84b060..f0f630672c1 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -151,3 +151,14 @@ impl<T> DomRefCell<T> {
self.value.try_borrow_mut()
}
}
+
+impl<T: Default> DomRefCell<T> {
+ /// Takes the wrapped value, leaving `Default::default()` in its place.
+ ///
+ /// # Panics
+ ///
+ /// Panics if the value is currently borrowed.
+ pub(crate) fn take(&self) -> T {
+ self.value.take()
+ }
+}