@@ -30,19 +30,19 @@ impl Drop for TokenStream {
3030}
3131
3232impl < S > Encode < S > for TokenStream {
33- fn encode ( self , w : & mut Writer , s : & mut S ) {
33+ fn encode ( self , w : & mut Buffer , s : & mut S ) {
3434 mem:: ManuallyDrop :: new ( self ) . handle . encode ( w, s) ;
3535 }
3636}
3737
3838impl < S > Encode < S > for & TokenStream {
39- fn encode ( self , w : & mut Writer , s : & mut S ) {
39+ fn encode ( self , w : & mut Buffer , s : & mut S ) {
4040 self . handle . encode ( w, s) ;
4141 }
4242}
4343
4444impl < S > Decode < ' _ , ' _ , S > for TokenStream {
45- fn decode ( r : & mut Reader < ' _ > , s : & mut S ) -> Self {
45+ fn decode ( r : & mut & [ u8 ] , s : & mut S ) -> Self {
4646 TokenStream { handle : handle:: Handle :: decode ( r, s) }
4747 }
4848}
@@ -56,23 +56,17 @@ impl !Send for Span {}
5656impl !Sync for Span { }
5757
5858impl < S > Encode < S > for Span {
59- fn encode ( self , w : & mut Writer , s : & mut S ) {
59+ fn encode ( self , w : & mut Buffer , s : & mut S ) {
6060 self . handle . encode ( w, s) ;
6161 }
6262}
6363
6464impl < S > Decode < ' _ , ' _ , S > for Span {
65- fn decode ( r : & mut Reader < ' _ > , s : & mut S ) -> Self {
65+ fn decode ( r : & mut & [ u8 ] , s : & mut S ) -> Self {
6666 Span { handle : handle:: Handle :: decode ( r, s) }
6767 }
6868}
6969
70- // FIXME(eddyb) generate these impls by pattern-matching on the
71- // names of methods - also could use the presence of `fn drop`
72- // to distinguish between 'owned and 'interned, above.
73- // Alternatively, special "modes" could be listed of types in with_api
74- // instead of pattern matching on methods, here and in server decl.
75-
7670impl Clone for TokenStream {
7771 fn clone ( & self ) -> Self {
7872 Methods :: ts_clone ( self )
@@ -104,18 +98,15 @@ pub(crate) use super::symbol::Symbol;
10498
10599macro_rules! define_client_side {
106100 (
107- Methods {
108- $( fn $method: ident( $( $arg: ident: $arg_ty: ty) ,* $( , ) ?) $( -> $ret_ty: ty) * ; ) *
109- } ,
110- $( $name: ident) ,* $( , ) ?
101+ $( fn $method: ident( $( $arg: ident: $arg_ty: ty) ,* $( , ) ?) $( -> $ret_ty: ty) * ; ) *
111102 ) => {
112103 impl Methods {
113104 $( pub ( crate ) fn $method( $( $arg: $arg_ty) ,* ) $( -> $ret_ty) ? {
114105 Bridge :: with( |bridge| {
115106 let mut buf = bridge. cached_buffer. take( ) ;
116107
117108 buf. clear( ) ;
118- api_tags :: Method :: $method. encode( & mut buf, & mut ( ) ) ;
109+ ApiTags :: $method. encode( & mut buf, & mut ( ) ) ;
119110 $( $arg. encode( & mut buf, & mut ( ) ) ; ) *
120111
121112 buf = bridge. dispatch. call( buf) ;
@@ -130,7 +121,7 @@ macro_rules! define_client_side {
130121 }
131122 }
132123}
133- with_api ! ( self , self , define_client_side) ;
124+ with_api ! ( self , define_client_side) ;
134125
135126struct Bridge < ' a > {
136127 /// Reusable buffer (only `clear`-ed, never shrunk), primarily
0 commit comments