aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-02 13:50:32 -0600
committerAlex Crichton <alex@alexcrichton.com>2014-11-02 13:50:32 -0600
commit902b3c6f8f6a5b23f7f6824a12d951527cb11d86 (patch)
tree6ff6ed05747ec2f41125d0c7d454dfb38ecc17a1
parent71d1689d63ef1af41addef330e314a56e88f48a9 (diff)
parentada3e6474d498006ea0918007f9ede3bbe2dea0e (diff)
downloadmilf-rs-902b3c6f8f6a5b23f7f6824a12d951527cb11d86.tar.gz
milf-rs-902b3c6f8f6a5b23f7f6824a12d951527cb11d86.zip
Merge pull request #27 from mikedilger/update_serialize
Update to rust master
-rw-r--r--src/serialization.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/serialization.rs b/src/serialization.rs
index afaa425..0ee527d 100644
--- a/src/serialization.rs
+++ b/src/serialization.rs
@@ -578,10 +578,16 @@ impl serialize::Decoder<DecodeError> for Decoder {
}
fn read_tuple<T>(&mut self,
- f: |&mut Decoder, uint| -> Result<T, DecodeError>)
+ tuple_len: uint,
+ f: |&mut Decoder| -> Result<T, DecodeError>)
-> Result<T, DecodeError>
{
- self.read_seq(f)
+ self.read_seq(|d, len| {
+ assert!(len == tuple_len,
+ "expected tuple of length `{}`, found tuple \
+ of length `{}`", tuple_len, len);
+ f(d)
+ })
}
fn read_tuple_arg<T>(&mut self, a_idx: uint,
f: |&mut Decoder| -> Result<T, DecodeError>)
@@ -592,7 +598,8 @@ impl serialize::Decoder<DecodeError> for Decoder {
fn read_tuple_struct<T>(&mut self,
_s_name: &str,
- _f: |&mut Decoder, uint| -> Result<T, DecodeError>)
+ _len: uint,
+ _f: |&mut Decoder| -> Result<T, DecodeError>)
-> Result<T, DecodeError>
{
panic!()