Skip to content

Commit

Permalink
feat(http): add get_mut method to HttpReader
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed May 23, 2015
1 parent e9dcf45 commit e64ce8c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ impl<R: Read> HttpReader<R> {
EmptyReader(r) => r,
}
}

/// Gets a mutable reference to the underlying Reader.
pub fn get_mut(&mut self) -> &mut R {
match *self {
SizedReader(ref mut r, _) => r,
ChunkedReader(ref mut r, _) => r,
EofReader(ref mut r) => r,
EmptyReader(ref mut r) => r,
}
}
}

impl<R> fmt::Debug for HttpReader<R> {
Expand Down Expand Up @@ -121,7 +131,9 @@ impl<R: Read> Read for HttpReader<R> {
Ok(count as usize)
},
EofReader(ref mut body) => {
body.read(buf)
let r = body.read(buf);
trace!("eofread: {:?}", r);
r
},
EmptyReader(_) => Ok(0)
}
Expand Down

0 comments on commit e64ce8c

Please sign in to comment.