@@ -151,8 +151,7 @@ pub const ILLEGAL_CTXT : SyntaxContext = 1;
151
151
152
152
/// A name is a part of an identifier, representing a string or gensym. It's
153
153
/// the result of interning.
154
- #[ derive( Eq , Ord , PartialEq , PartialOrd , Hash ,
155
- RustcEncodable , RustcDecodable , Clone , Copy ) ]
154
+ #[ derive( Eq , Ord , PartialEq , PartialOrd , Hash , Clone , Copy ) ]
156
155
pub struct Name ( pub u32 ) ;
157
156
158
157
impl < T : AsRef < str > > PartialEq < T > for Name {
@@ -179,6 +178,18 @@ impl Name {
179
178
/// A mark represents a unique id associated with a macro expansion
180
179
pub type Mrk = u32 ;
181
180
181
+ impl Encodable for Name {
182
+ fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
183
+ s. emit_str ( & self . as_str ( ) )
184
+ }
185
+ }
186
+
187
+ impl Decodable for Name {
188
+ fn decode < D : Decoder > ( d : & mut D ) -> Result < Name , D :: Error > {
189
+ Ok ( token:: intern ( & try!( d. read_str ( ) ) [ ..] ) )
190
+ }
191
+ }
192
+
182
193
impl Encodable for Ident {
183
194
fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
184
195
s. emit_str ( & self . name . as_str ( ) )
0 commit comments