diff options
| author | Ben Gamari <bgamari.foss@gmail.com> | 2014-07-12 00:50:57 -0400 |
|---|---|---|
| committer | Ben Gamari <bgamari.foss@gmail.com> | 2014-07-15 18:54:47 -0400 |
| commit | 69ffcdcccfec6e2af67c3b0b1e2ebef2d33847bd (patch) | |
| tree | 5d52cac0f1a964740cf466c4b24956256d233a5d /src/libsyntax/owned_slice.rs | |
| parent | de111e69a89c15e77f5f0c49c2f6ab4c25aa89c1 (diff) | |
| download | rust-69ffcdcccfec6e2af67c3b0b1e2ebef2d33847bd.tar.gz rust-69ffcdcccfec6e2af67c3b0b1e2ebef2d33847bd.zip | |
libsyntax::ast: Derive Show impls
Diffstat (limited to 'src/libsyntax/owned_slice.rs')
| -rw-r--r-- | src/libsyntax/owned_slice.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs index 530ea013112..7eb6709919a 100644 --- a/src/libsyntax/owned_slice.rs +++ b/src/libsyntax/owned_slice.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::fmt; use std::default::Default; use std::hash; use std::{mem, raw, ptr, slice}; @@ -22,6 +23,17 @@ pub struct OwnedSlice<T> { len: uint, } +impl<T:fmt::Show> fmt::Show for OwnedSlice<T> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!("OwnedSlice {{".fmt(fmt)); + for i in self.iter() { + try!(i.fmt(fmt)); + } + try!("}}".fmt(fmt)); + Ok(()) + } +} + #[unsafe_destructor] impl<T> Drop for OwnedSlice<T> { fn drop(&mut self) { |
