Skip to content

Commit 7df3faa

Browse files
authored
hybrid-array: impl From<Array<T, U>> for [T; N] (#945)
Allows for converting a hybrid array to its inner core array.
1 parent 2e78c4b commit 7df3faa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hybrid-array/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,12 @@ macro_rules! impl_array_size {
556556
type ArrayType<T> = [T; $len];
557557
}
558558

559+
impl<T> From<Array<T, typenum::$ty>> for [T; $len] {
560+
fn from(arr: Array<T, typenum::$ty>) -> [T; $len] {
561+
arr.0
562+
}
563+
}
564+
559565
impl<T> IntoArray<T> for [T; $len] {
560566
type Size = typenum::$ty;
561567

0 commit comments

Comments
 (0)