@@ -379,10 +379,32 @@ pub trait Decoder {
379379 fn error ( & mut self , err : & str ) -> Self :: Error ;
380380}
381381
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.
382393pub trait Encodable < S : Encoder > {
383394 fn encode ( & self , s : & mut S ) -> Result < ( ) , S :: Error > ;
384395}
385396
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.
386408pub trait Decodable < D : Decoder > : Sized {
387409 fn decode ( d : & mut D ) -> Result < Self , D :: Error > ;
388410}
0 commit comments