File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 3737 toolchain : ${{ matrix.rust }}
3838 targets : ${{ matrix.target }}
3939 - run : cargo build --no-default-features --target ${{ matrix.target }}
40+ - run : cargo build --no-default-features --target ${{ matrix.target }} --features alloc
4041 - run : cargo build --no-default-features --target ${{ matrix.target }} --features bytemuck
4142 - run : cargo build --no-default-features --target ${{ matrix.target }} --features extra-sizes
4243 - run : cargo build --no-default-features --target ${{ matrix.target }} --features serde
@@ -110,6 +111,7 @@ jobs:
110111 with :
111112 toolchain : ${{ matrix.toolchain }}
112113 - run : cargo test
114+ - run : cargo test --features alloc
113115 - run : cargo test --features bytemuck
114116 - run : cargo test --features extra-sizes
115117 - run : cargo test --features serde
Original file line number Diff line number Diff line change @@ -666,6 +666,52 @@ where
666666 }
667667}
668668
669+ #[ cfg( feature = "alloc" ) ]
670+ impl < T , U > From < Array < T , U > > for alloc:: boxed:: Box < [ T ] >
671+ where
672+ U : ArraySize ,
673+ {
674+ #[ inline]
675+ fn from ( array : Array < T , U > ) -> alloc:: boxed:: Box < [ T ] > {
676+ alloc:: vec:: Vec :: from ( array) . into_boxed_slice ( )
677+ }
678+ }
679+
680+ #[ cfg( feature = "alloc" ) ]
681+ impl < T , U > From < & Array < T , U > > for alloc:: boxed:: Box < [ T ] >
682+ where
683+ T : Clone ,
684+ U : ArraySize ,
685+ {
686+ #[ inline]
687+ fn from ( array : & Array < T , U > ) -> alloc:: boxed:: Box < [ T ] > {
688+ array. as_slice ( ) . into ( )
689+ }
690+ }
691+
692+ #[ cfg( feature = "alloc" ) ]
693+ impl < T , U > From < Array < T , U > > for alloc:: vec:: Vec < T >
694+ where
695+ U : ArraySize ,
696+ {
697+ #[ inline]
698+ fn from ( array : Array < T , U > ) -> alloc:: vec:: Vec < T > {
699+ array. into_iter ( ) . collect ( )
700+ }
701+ }
702+
703+ #[ cfg( feature = "alloc" ) ]
704+ impl < T , U > From < & Array < T , U > > for alloc:: vec:: Vec < T >
705+ where
706+ T : Clone ,
707+ U : ArraySize ,
708+ {
709+ #[ inline]
710+ fn from ( array : & Array < T , U > ) -> alloc:: vec:: Vec < T > {
711+ array. as_slice ( ) . into ( )
712+ }
713+ }
714+
669715impl < T , U > Hash for Array < T , U >
670716where
671717 T : Hash ,
You can’t perform that action at this time.
0 commit comments