about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMichael Arntzenius <daekharel@gmail.com>2012-11-28 12:35:08 -0500
committerPatrick Walton <pcwalton@mimiga.net>2012-11-28 11:27:05 -0800
commitd2d6d955f45682399bce2a270e1ffaf2908fe0b0 (patch)
tree7005ec346e0b78ca9c5103cdac9575f25aaf44ba /src/libcore
parentca6970a65ebdc153d53e9b6c2ccb224ee705ac94 (diff)
libcore/to_bytes.rs: add IterBytes impls for pairs and triples. r=pcwalton
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/to_bytes.rs19
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