Skip to content

Commit

Permalink
Add Default implementation for SmallBox
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Oct 3, 2024
1 parent e58641c commit 387a3d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/smallbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ pub struct SmallBox<T: ?Sized, Space> {
_phantom: PhantomData<T>,
}

impl<T: Default, Space> Default for SmallBox<T, Space> {
fn default() -> Self {
Self::new(T::default())
}
}

impl<T: ?Sized, Space> SmallBox<T, Space> {
/// Box value on stack or on heap depending on its size.
///
Expand Down

0 comments on commit 387a3d3

Please sign in to comment.