Skip to content

Commit

Permalink
Add Default implementation for SmallBox (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev authored Oct 4, 2024
1 parent e58641c commit d93c886
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 d93c886

Please sign in to comment.