@@ -12,7 +12,7 @@ pub(super) trait Encode<S>: Sized {
1212
1313pub ( super )  type  Reader < ' a >  = & ' a  [ u8 ] ; 
1414
15- pub ( super )  trait  DecodeMut < ' a ,  ' s ,  S > :  Sized  { 
15+ pub ( super )  trait  Decode < ' a ,  ' s ,  S > :  Sized  { 
1616    fn  decode ( r :  & mut  Reader < ' a > ,  s :  & ' s  mut  S )  -> Self ; 
1717} 
1818
@@ -24,7 +24,7 @@ macro_rules! rpc_encode_decode {
2424            } 
2525        } 
2626
27-         impl <S > DecodeMut <' _,  ' _,  S > for  $ty { 
27+         impl <S > Decode <' _,  ' _,  S > for  $ty { 
2828            fn  decode( r:  & mut  Reader <' _>,  _:  & mut  S )  -> Self  { 
2929                const  N :  usize  = size_of:: <$ty>( ) ; 
3030
@@ -43,12 +43,12 @@ macro_rules! rpc_encode_decode {
4343            } 
4444        } 
4545
46-         impl <' a,  S ,  $( $( $T:  for <' s> DecodeMut <' a,  ' s,  S >) ,+) ?> DecodeMut <' a,  ' _,  S >
46+         impl <' a,  S ,  $( $( $T:  for <' s> Decode <' a,  ' s,  S >) ,+) ?> Decode <' a,  ' _,  S >
4747            for  $name $( <$( $T) ,+>) ?
4848        { 
4949            fn  decode( r:  & mut  Reader <' a>,  s:  & mut  S )  -> Self  { 
5050                $name { 
51-                     $( $field:  DecodeMut :: decode( r,  s) ) ,* 
51+                     $( $field:  Decode :: decode( r,  s) ) ,* 
5252                } 
5353            } 
5454        } 
@@ -58,23 +58,18 @@ macro_rules! rpc_encode_decode {
5858            fn  encode( self ,  w:  & mut  Writer ,  s:  & mut  S )  { 
5959                // HACK(eddyb): `Tag` enum duplicated between the 
6060                // two impls as there's no other place to stash it. 
61-                 #[ allow( non_upper_case_globals) ] 
62-                 mod  tag { 
63-                     #[ repr( u8 ) ]  enum  Tag  {  $( $variant) ,*  } 
64- 
65-                     $( pub ( crate )  const  $variant:  u8  = Tag :: $variant as  u8 ; ) * 
66-                 } 
61+                 #[ repr( u8 ) ]  enum  Tag  {  $( $variant) ,*  } 
6762
6863                match  self  { 
6964                    $( $name:: $variant $( ( $field) ) *  => { 
70-                         tag :: $variant. encode( w,  s) ; 
65+                         ( Tag :: $variant  as   u8 ) . encode( w,  s) ; 
7166                        $( $field. encode( w,  s) ; ) * 
7267                    } ) * 
7368                } 
7469            } 
7570        } 
7671
77-         impl <' a,  S ,  $( $( $T:  for <' s> DecodeMut <' a,  ' s,  S >) ,+) ?> DecodeMut <' a,  ' _,  S >
72+         impl <' a,  S ,  $( $( $T:  for <' s> Decode <' a,  ' s,  S >) ,+) ?> Decode <' a,  ' _,  S >
7873            for  $name $( <$( $T) ,+>) ?
7974        { 
8075            fn  decode( r:  & mut  Reader <' a>,  s:  & mut  S )  -> Self  { 
@@ -89,7 +84,7 @@ macro_rules! rpc_encode_decode {
8984
9085                match  u8 :: decode( r,  s)  { 
9186                    $( tag:: $variant => { 
92-                         $( let  $field = DecodeMut :: decode( r,  s) ; ) * 
87+                         $( let  $field = Decode :: decode( r,  s) ; ) * 
9388                        $name:: $variant $( ( $field) ) * 
9489                    } ) * 
9590                    _ => unreachable!( ) , 
@@ -103,7 +98,7 @@ impl<S> Encode<S> for () {
10398    fn  encode ( self ,  _:  & mut  Writer ,  _:  & mut  S )  { } 
10499} 
105100
106- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  ( )  { 
101+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  ( )  { 
107102    fn  decode ( _:  & mut  Reader < ' _ > ,  _:  & mut  S )  -> Self  { } 
108103} 
109104
@@ -113,7 +108,7 @@ impl<S> Encode<S> for u8 {
113108    } 
114109} 
115110
116- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  u8  { 
111+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  u8  { 
117112    fn  decode ( r :  & mut  Reader < ' _ > ,  _:  & mut  S )  -> Self  { 
118113        let  x = r[ 0 ] ; 
119114        * r = & r[ 1 ..] ; 
@@ -130,7 +125,7 @@ impl<S> Encode<S> for bool {
130125    } 
131126} 
132127
133- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  bool  { 
128+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  bool  { 
134129    fn  decode ( r :  & mut  Reader < ' _ > ,  s :  & mut  S )  -> Self  { 
135130        match  u8:: decode ( r,  s)  { 
136131            0  => false , 
@@ -146,7 +141,7 @@ impl<S> Encode<S> for char {
146141    } 
147142} 
148143
149- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  char  { 
144+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  char  { 
150145    fn  decode ( r :  & mut  Reader < ' _ > ,  s :  & mut  S )  -> Self  { 
151146        char:: from_u32 ( u32:: decode ( r,  s) ) . unwrap ( ) 
152147    } 
@@ -158,7 +153,7 @@ impl<S> Encode<S> for NonZero<u32> {
158153    } 
159154} 
160155
161- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  NonZero < u32 >  { 
156+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  NonZero < u32 >  { 
162157    fn  decode ( r :  & mut  Reader < ' _ > ,  s :  & mut  S )  -> Self  { 
163158        Self :: new ( u32:: decode ( r,  s) ) . unwrap ( ) 
164159    } 
@@ -171,11 +166,11 @@ impl<S, A: Encode<S>, B: Encode<S>> Encode<S> for (A, B) {
171166    } 
172167} 
173168
174- impl < ' a ,  S ,  A :  for < ' s >  DecodeMut < ' a ,  ' s ,  S > ,  B :  for < ' s >  DecodeMut < ' a ,  ' s ,  S > >  DecodeMut < ' a ,  ' _ ,  S > 
169+ impl < ' a ,  S ,  A :  for < ' s >  Decode < ' a ,  ' s ,  S > ,  B :  for < ' s >  Decode < ' a ,  ' s ,  S > >  Decode < ' a ,  ' _ ,  S > 
175170    for  ( A ,  B ) 
176171{ 
177172    fn  decode ( r :  & mut  Reader < ' a > ,  s :  & mut  S )  -> Self  { 
178-         ( DecodeMut :: decode ( r,  s) ,  DecodeMut :: decode ( r,  s) ) 
173+         ( Decode :: decode ( r,  s) ,  Decode :: decode ( r,  s) ) 
179174    } 
180175} 
181176
@@ -186,7 +181,7 @@ impl<S> Encode<S> for &[u8] {
186181    } 
187182} 
188183
189- impl < ' a ,  S >  DecodeMut < ' a ,  ' _ ,  S >  for  & ' a  [ u8 ]  { 
184+ impl < ' a ,  S >  Decode < ' a ,  ' _ ,  S >  for  & ' a  [ u8 ]  { 
190185    fn  decode ( r :  & mut  Reader < ' a > ,  s :  & mut  S )  -> Self  { 
191186        let  len = usize:: decode ( r,  s) ; 
192187        let  xs = & r[ ..len] ; 
@@ -201,7 +196,7 @@ impl<S> Encode<S> for &str {
201196    } 
202197} 
203198
204- impl < ' a ,  S >  DecodeMut < ' a ,  ' _ ,  S >  for  & ' a  str  { 
199+ impl < ' a ,  S >  Decode < ' a ,  ' _ ,  S >  for  & ' a  str  { 
205200    fn  decode ( r :  & mut  Reader < ' a > ,  s :  & mut  S )  -> Self  { 
206201        str:: from_utf8 ( <& [ u8 ] >:: decode ( r,  s) ) . unwrap ( ) 
207202    } 
@@ -213,7 +208,7 @@ impl<S> Encode<S> for String {
213208    } 
214209} 
215210
216- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  String  { 
211+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  String  { 
217212    fn  decode ( r :  & mut  Reader < ' _ > ,  s :  & mut  S )  -> Self  { 
218213        <& str >:: decode ( r,  s) . to_string ( ) 
219214    } 
@@ -228,7 +223,7 @@ impl<S, T: Encode<S>> Encode<S> for Vec<T> {
228223    } 
229224} 
230225
231- impl < ' a ,  S ,  T :  for < ' s >  DecodeMut < ' a ,  ' s ,  S > >  DecodeMut < ' a ,  ' _ ,  S >  for  Vec < T >  { 
226+ impl < ' a ,  S ,  T :  for < ' s >  Decode < ' a ,  ' s ,  S > >  Decode < ' a ,  ' _ ,  S >  for  Vec < T >  { 
232227    fn  decode ( r :  & mut  Reader < ' a > ,  s :  & mut  S )  -> Self  { 
233228        let  len = usize:: decode ( r,  s) ; 
234229        let  mut  vec = Vec :: with_capacity ( len) ; 
@@ -288,7 +283,7 @@ impl<S> Encode<S> for PanicMessage {
288283    } 
289284} 
290285
291- impl < S >  DecodeMut < ' _ ,  ' _ ,  S >  for  PanicMessage  { 
286+ impl < S >  Decode < ' _ ,  ' _ ,  S >  for  PanicMessage  { 
292287    fn  decode ( r :  & mut  Reader < ' _ > ,  s :  & mut  S )  -> Self  { 
293288        match  Option :: < String > :: decode ( r,  s)  { 
294289            Some ( s)  => PanicMessage :: String ( s) , 
0 commit comments