]> git.lizzy.rs Git - rust.git/commitdiff
Adding show impl for Rc
authorfort <e@mail.com>
Mon, 2 Jun 2014 06:35:15 +0000 (23:35 -0700)
committerfort <e@mail.com>
Tue, 3 Jun 2014 01:53:08 +0000 (18:53 -0700)
src/liballoc/rc.rs

index 7177aa3de45e8f32d5cbb45365d634fd326c2f50..416a6ad2d8b7a3d5a8c064909fce9b76d2e1c9c1 100644 (file)
@@ -33,6 +33,7 @@
 use core::ptr;
 use core::ptr::RawPtr;
 use core::mem::{min_align_of, size_of};
+use core::fmt;
 
 use heap::deallocate;
 
@@ -178,6 +179,12 @@ impl<T: Ord> Ord for Rc<T> {
     fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
 }
 
+impl<T: fmt::Show> fmt::Show for Rc<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        (**self).fmt(f)
+    }
+}
+
 /// Weak reference to a reference-counted box
 #[unsafe_no_drop_flag]
 pub struct Weak<T> {