Skip to content

Commit

Permalink
libcore/to_bytes.rs: add IterBytes impls for pairs and triples
Browse files Browse the repository at this point in the history
  • Loading branch information
rntz committed Nov 28, 2012
1 parent 68c73dc commit d718bc2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/libcore/to_bytes.rs
Expand Up @@ -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
Expand Down

0 comments on commit d718bc2

Please sign in to comment.