Skip to content

Commit d718bc2

Browse files
committed
libcore/to_bytes.rs: add IterBytes impls for pairs and triples
1 parent 68c73dc commit d718bc2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/libcore/to_bytes.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,25 @@ impl<A: IterBytes> &[A]: IterBytes {
191191
}
192192
}
193193

194+
impl<A: IterBytes, B: IterBytes> (A,B): IterBytes {
195+
#[inline(always)]
196+
pure fn iter_bytes(lsb0: bool, f: Cb) {
197+
let &(ref a, ref b) = &self;
198+
a.iter_bytes(lsb0, f);
199+
b.iter_bytes(lsb0, f);
200+
}
201+
}
202+
203+
impl<A: IterBytes, B: IterBytes, C: IterBytes> (A,B,C): IterBytes {
204+
#[inline(always)]
205+
pure fn iter_bytes(lsb0: bool, f: Cb) {
206+
let &(ref a, ref b, ref c) = &self;
207+
a.iter_bytes(lsb0, f);
208+
b.iter_bytes(lsb0, f);
209+
c.iter_bytes(lsb0, f);
210+
}
211+
}
212+
194213
// Move this to vec, probably.
195214
pure fn borrow<A>(a: &x/[A]) -> &x/[A] {
196215
a

0 commit comments

Comments
 (0)