diff options
| author | Michael Arntzenius <daekharel@gmail.com> | 2012-11-28 12:35:08 -0500 |
|---|---|---|
| committer | Michael Arntzenius <daekharel@gmail.com> | 2012-11-28 12:35:08 -0500 |
| commit | d718bc292d342a99580ec971dc7e873e5fc6e5c4 (patch) | |
| tree | 985586dd6ee66013f8d3a251a271d28e3a45da1d /src/libcore | |
| parent | 68c73dc5f29bf75d6c76054ebfaf2fbb3751a71b (diff) | |
libcore/to_bytes.rs: add IterBytes impls for pairs and triples
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/to_bytes.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index ef15aa00f11..3aaa3ab8d91 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -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 |
