@@ -379,10 +379,32 @@ pub trait Decoder {
379
379
fn error ( & mut self , err : & str ) -> Self :: Error ;
380
380
}
381
381
382
+ /// Trait for types that can be serialized
383
+ ///
384
+ /// This can be implemented using the `Encodable`, `TyEncodable` and
385
+ /// `MetadataEncodable` macros.
386
+ ///
387
+ /// * `Encodable` should be used in crates that don't depend on
388
+ /// `librustc_middle`.
389
+ /// * `TyEncodable` should be used for types that are only serialized in crate
390
+ /// metadata or the incremental cache, except for simple enums.where
391
+ /// * `MetadataEncodable` is used in `rustc_metadata` for types that are only
392
+ /// serialized in crate metadata.
382
393
pub trait Encodable < S : Encoder > {
383
394
fn encode ( & self , s : & mut S ) -> Result < ( ) , S :: Error > ;
384
395
}
385
396
397
+ /// Trait for types that can be deserialized
398
+ ///
399
+ /// This can be implemented using the `Decodable`, `TyDecodable` and
400
+ /// `MetadataDecodable` macros.
401
+ ///
402
+ /// * `Decodable` should be used in crates that don't depend on
403
+ /// `librustc_middle`.
404
+ /// * `TyDecodable` should be used for types that are only serialized in crate
405
+ /// metadata or the incremental cache, except for simple enums.where
406
+ /// * `MetadataDecodable` is used in `rustc_metadata` for types that are only
407
+ /// serialized in crate metadata.
386
408
pub trait Decodable < D : Decoder > : Sized {
387
409
fn decode ( d : & mut D ) -> Result < Self , D :: Error > ;
388
410
}
0 commit comments