libcore/to_bytes.rs: add IterBytes impls for pairs and triples

This commit is contained in:
Michael Arntzenius 2012-11-28 12:35:08 -05:00
parent 68c73dc5f2
commit d718bc292d

View File

@ -191,6 +191,25 @@ impl<A: IterBytes> &[A]: IterBytes {
}
}
impl<A: IterBytes, B: IterBytes> (A,B): IterBytes {
#[inline(always)]
pure fn iter_bytes(lsb0: bool, f: Cb) {
let &(ref a, ref b) = &self;
a.iter_bytes(lsb0, f);
b.iter_bytes(lsb0, f);
}
}
impl<A: IterBytes, B: IterBytes, C: IterBytes> (A,B,C): IterBytes {
#[inline(always)]
pure fn iter_bytes(lsb0: bool, f: Cb) {
let &(ref a, ref b, ref c) = &self;
a.iter_bytes(lsb0, f);
b.iter_bytes(lsb0, f);
c.iter_bytes(lsb0, f);
}
}
// Move this to vec, probably.
pure fn borrow<A>(a: &x/[A]) -> &x/[A] {
a