From d718bc292d342a99580ec971dc7e873e5fc6e5c4 Mon Sep 17 00:00:00 2001 From: Michael Arntzenius Date: Wed, 28 Nov 2012 12:35:08 -0500 Subject: [PATCH] libcore/to_bytes.rs: add IterBytes impls for pairs and triples --- src/libcore/to_bytes.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index ef15aa00f1138..3aaa3ab8d9183 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -191,6 +191,25 @@ impl &[A]: IterBytes { } } +impl (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,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: &x/[A]) -> &x/[A] { a