From 5b3f27746529c746231d1d1ddef83b5c4e0b2160 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 13 Mar 2020 19:29:32 -0700 Subject: [PATCH] Implement `Default` for `ArcRefCell` --- components/layout_2020/cell.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/layout_2020/cell.rs b/components/layout_2020/cell.rs index e12201e4b28..8aae377b24c 100644 --- a/components/layout_2020/cell.rs +++ b/components/layout_2020/cell.rs @@ -28,6 +28,17 @@ impl Clone for ArcRefCell { } } +impl Default for ArcRefCell +where + T: Default, +{ + fn default() -> Self { + Self { + value: Arc::new(AtomicRefCell::new(Default::default())), + } + } +} + impl Deref for ArcRefCell { type Target = AtomicRefCell;