add more docs

This commit is contained in:
Ty Overby 2016-02-07 16:46:23 -08:00
parent 24c8ce8b37
commit 25cfb15823
2 changed files with 14 additions and 0 deletions

View File

@ -100,6 +100,13 @@ impl From<IoError> for DecodingError {
/// ///
/// This struct should rarely be used. /// This struct should rarely be used.
/// In most cases, prefer the `decode_from` function. /// In most cases, prefer the `decode_from` function.
///
/// ```no_run
/// let file = ...
/// let dr = bincode::rustc_serialize::DecoderReader::new(&mut file, SizeLimit::Infinite);
/// let result: T = Decodable::decode(&mut dr);
/// let bytes_red = dr.bytes_read();
/// ```
pub struct DecoderReader<'a, R: 'a> { pub struct DecoderReader<'a, R: 'a> {
reader: &'a mut R, reader: &'a mut R,
size_limit: SizeLimit, size_limit: SizeLimit,

View File

@ -154,6 +154,13 @@ pub type DeserializeResult<T> = Result<T, DeserializeError>;
/// ///
/// This struct should rarely be used. /// This struct should rarely be used.
/// In most cases, prefer the `decode_from` function. /// In most cases, prefer the `decode_from` function.
///
/// ```no_run
/// let file = ...
/// let d = Deserializer::new(&mut file, SizeLimit::new());
/// serde::Deserialize::deserialize(&mut deserializer);
/// let bytes_read = d.bytes_read();
/// ```
pub struct Deserializer<'a, R: 'a> { pub struct Deserializer<'a, R: 'a> {
reader: &'a mut R, reader: &'a mut R,
size_limit: SizeLimit, size_limit: SizeLimit,