feat(data_structures): implement Default for NonEmptyStack (#7946)

Implement `Default` for `NonEmptyStack<T>` where `T: Default`.
This commit is contained in:
overlookmotel 2024-12-16 21:02:52 +00:00
parent ff2a68f22b
commit 46e2e27735

View file

@ -366,6 +366,12 @@ impl<T> DerefMut for NonEmptyStack<T> {
}
}
impl<T: Default> Default for NonEmptyStack<T> {
fn default() -> Self {
Self::new(T::default())
}
}
#[cfg(test)]
mod tests {
use super::*;