From 387a3d326abaa2338854742081067012fa8e1c82 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Thu, 3 Oct 2024 23:11:50 +0100 Subject: [PATCH] Add Default implementation for SmallBox --- src/smallbox.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/smallbox.rs b/src/smallbox.rs index ad44693..3b90761 100644 --- a/src/smallbox.rs +++ b/src/smallbox.rs @@ -72,6 +72,12 @@ pub struct SmallBox { _phantom: PhantomData, } +impl Default for SmallBox { + fn default() -> Self { + Self::new(T::default()) + } +} + impl SmallBox { /// Box value on stack or on heap depending on its size. ///