diff options
| author | bors <bors@rust-lang.org> | 2013-11-25 13:11:43 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-11-25 13:11:43 -0800 |
| commit | e632c440f88b3e252bf8c0942fc7be21d9e946d3 (patch) | |
| tree | 9f3cb0bcbd64e827f2c0ceefa03a2ee162697311 /src/libstd | |
| parent | 6fe6a6f9dfffe0de08fefb78787c178e2f89a8a4 (diff) | |
| parent | ae836c1e44d7459d4588e622a8535f127e32716f (diff) | |
| download | rust-e632c440f88b3e252bf8c0942fc7be21d9e946d3.tar.gz rust-e632c440f88b3e252bf8c0942fc7be21d9e946d3.zip | |
auto merge of #10658 : LeoTestard/rust/serialize-rc, r=cmr
Implement various traits (IterBytes and extra's Encodable and Decodable) for Rc<T> when T alreay implements the trait.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/to_bytes.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs index 8b424c53be0..28b79bdd320 100644 --- a/src/libstd/to_bytes.rs +++ b/src/libstd/to_bytes.rs @@ -18,6 +18,7 @@ use cast; use container::Container; use iter::Iterator; use option::{None, Option, Some}; +use rc::Rc; use str::{Str, StrSlice}; use vec::{Vector, ImmutableVector}; @@ -325,6 +326,13 @@ impl<A:IterBytes> IterBytes for @mut A { } } +impl<A:IterBytes> IterBytes for Rc<A> { + #[inline] + fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { + self.borrow().iter_bytes(lsb0, f) + } +} + impl<A:IterBytes> IterBytes for ~A { #[inline] fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { |
