libsyntax::ast: Derive Show impls

This commit is contained in:
Ben Gamari 2014-07-12 00:50:57 -04:00
parent de111e69a8
commit 69ffcdcccf
2 changed files with 82 additions and 70 deletions

View file

@ -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) {