File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -639,6 +639,8 @@ pub trait RemoveAxis : Dimension {
639639}
640640
641641macro_rules! impl_shrink(
642+ ( $_a: ident, ) => { } ; // implement this case manually below
643+ ( $_a: ident, $_b: ident, ) => { } ; // implement this case manually below
642644 ( $from: ident, $( $more: ident, ) * ) => (
643645impl RemoveAxis for ( $from $( , $more) * )
644646{
@@ -665,6 +667,22 @@ impl RemoveAxis for ($from $(,$more)*)
665667 )
666668) ;
667669
670+ impl RemoveAxis for Ix {
671+ type Smaller = ( ) ;
672+ #[ inline]
673+ fn remove_axis ( & self , _: Axis ) { }
674+ }
675+
676+ impl RemoveAxis for ( Ix , Ix ) {
677+ type Smaller = Ix ;
678+ #[ inline]
679+ fn remove_axis ( & self , axis : Axis ) -> Ix {
680+ let axis = axis. axis ( ) ;
681+ debug_assert ! ( axis < self . ndim( ) ) ;
682+ if axis == 0 { self . 1 } else { self . 0 }
683+ }
684+ }
685+
668686macro_rules! impl_shrink_recursive(
669687 ( $ix: ident, ) => ( impl_shrink!( $ix, ) ; ) ;
670688 ( $ix1: ident, $( $ix: ident, ) * ) => (
You can’t perform that action at this time.
0 commit comments