mirror of https://git.sr.ht/~stygianentity/bincode
Merge pull request #28 from mikedilger/rustc_changes
Fix for upstream rustc changes
This commit is contained in:
commit
fdb5de2631
|
|
@ -45,7 +45,7 @@ fn main() {
|
||||||
// 8 bytes for the length of the vector, 4 bytes per float.
|
// 8 bytes for the length of the vector, 4 bytes per float.
|
||||||
assert_eq!(encoded.len(), 8 + 4 * 4);
|
assert_eq!(encoded.len(), 8 + 4 * 4);
|
||||||
|
|
||||||
let decoded: World = bincode::decode(&encoded[]).unwrap();
|
let decoded: World = bincode::decode(&encoded[..]).unwrap();
|
||||||
|
|
||||||
assert!(world == decoded);
|
assert!(world == decoded);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ mod refbox;
|
||||||
///! let limit = bincode::SizeLimit::Bounded(20);
|
///! let limit = bincode::SizeLimit::Bounded(20);
|
||||||
///!
|
///!
|
||||||
///! let encoded: Vec<u8> = bincode::encode(&target, limit).unwrap();
|
///! let encoded: Vec<u8> = bincode::encode(&target, limit).unwrap();
|
||||||
///! let decoded: Option<String> = bincode::decode(&encoded[]).unwrap();
|
///! let decoded: Option<String> = bincode::decode(&encoded[..]).unwrap();
|
||||||
///! assert_eq!(target, decoded);
|
///! assert_eq!(target, decoded);
|
||||||
///! }
|
///! }
|
||||||
///! ```
|
///! ```
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,8 @@ impl<'a, R: Read> DecoderReader<'a, R> {
|
||||||
impl <'a, A> DecoderReader<'a, A> {
|
impl <'a, A> DecoderReader<'a, A> {
|
||||||
fn read_bytes<I>(&mut self, count: I) -> Result<(), DecodingError>
|
fn read_bytes<I>(&mut self, count: I) -> Result<(), DecodingError>
|
||||||
where I: NumCast {
|
where I: NumCast {
|
||||||
self.read += cast(count).unwrap();
|
let count: u64 = cast(count).unwrap();
|
||||||
|
self.read += count;
|
||||||
match self.size_limit {
|
match self.size_limit {
|
||||||
SizeLimit::Infinite => Ok(()),
|
SizeLimit::Infinite => Ok(()),
|
||||||
SizeLimit::Bounded(x) if self.read <= x => Ok(()),
|
SizeLimit::Bounded(x) if self.read <= x => Ok(()),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue