File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use alloc::vec::Vec;
1313
1414use super :: axes_of;
1515use super :: conversion:: Convert ;
16+ use super :: ops:: DimAdd ;
1617use super :: { stride_offset, stride_offset_checked} ;
1718use crate :: itertools:: { enumerate, zip} ;
1819use crate :: { Axis , DimMax } ;
@@ -51,6 +52,12 @@ pub trait Dimension:
5152 + DimMax < IxDyn , Output =IxDyn >
5253 + DimMax < <Self as Dimension >:: Smaller , Output =Self >
5354 + DimMax < <Self as Dimension >:: Larger , Output =<Self as Dimension >:: Larger >
55+ + DimAdd < Self >
56+ + DimAdd < <Self as Dimension >:: Smaller >
57+ + DimAdd < <Self as Dimension >:: Larger >
58+ + DimAdd < Ix0 , Out = Self >
59+ + DimAdd < Ix1 , Out = <Self as Dimension >:: Larger >
60+ + DimAdd < IxDyn , Out = IxDyn >
5461{
5562 /// For fixed-size dimension representations (e.g. `Ix2`), this should be
5663 /// `Some(ndim)`, and for variable-size dimension representations (e.g.
Original file line number Diff line number Diff line change 11use crate :: imp_prelude:: * ;
22
33/// Adds the two dimensions at compile time.
4- pub trait DimAdd < D : Dimension > : Dimension {
4+ pub trait DimAdd < D : Dimension > {
55 /// The sum of the two dimensions.
66 type Out : Dimension ;
77}
Original file line number Diff line number Diff line change @@ -661,14 +661,14 @@ pub trait SliceArg {
661661 /// Number of dimensions that this slicing argument produces in the output array.
662662 type OutDim : Dimension ;
663663
664- fn next_in_dim < D > ( & self , _: PhantomData < D > ) -> PhantomData < D :: Out >
664+ fn next_in_dim < D > ( & self , _: PhantomData < D > ) -> PhantomData < < D as DimAdd < Self :: InDim > > :: Out >
665665 where
666666 D : Dimension + DimAdd < Self :: InDim > ,
667667 {
668668 PhantomData
669669 }
670670
671- fn next_out_dim < D > ( & self , _: PhantomData < D > ) -> PhantomData < D :: Out >
671+ fn next_out_dim < D > ( & self , _: PhantomData < D > ) -> PhantomData < < D as DimAdd < Self :: OutDim > > :: Out >
672672 where
673673 D : Dimension + DimAdd < Self :: OutDim > ,
674674 {
You can’t perform that action at this time.
0 commit comments