Skip to content

Commit db2e12b

Browse files
committed
hybrid-array: impl Default for Array
1 parent b6cedcf commit db2e12b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hybrid-array/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ macro_rules! impl_array_size {
184184
}
185185
}
186186

187+
impl<T> Default for Array<T, typenum::$ty>
188+
where
189+
T: Default
190+
{
191+
fn default() -> Self {
192+
Self([(); $len].map(|_| T::default()))
193+
}
194+
}
195+
187196
impl<T> IntoIterator for Array<T, typenum::$ty> {
188197
type Item = T;
189198
type IntoIter = IntoIter<T, $len>;

0 commit comments

Comments
 (0)