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

This commit is contained in:
Michael Arntzenius 2012-11-28 12:35:08 -05:00 committed by Patrick Walton
parent ca6970a65e
commit d2d6d955f4

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