From b6615fa26226153d5b0ac3e15a80364b94de708e Mon Sep 17 00:00:00 2001 From: Ty Overby Date: Sat, 2 May 2015 12:56:36 -0700 Subject: [PATCH] derive debug for refbox and friends --- src/refbox.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/refbox.rs b/src/refbox.rs index 8f72c35..419393f 100644 --- a/src/refbox.rs +++ b/src/refbox.rs @@ -1,6 +1,5 @@ use std::boxed::Box; use std::ops::Deref; -use std::fmt; use rustc_serialize::{Encodable, Encoder}; use rustc_serialize::{Decodable, Decoder}; @@ -57,16 +56,19 @@ use rustc_serialize::{Decodable, Decoder}; /// /// Please don't stick RefBox inside deep data structures. It is much better /// suited in the outermost layer of whatever it is that you are encoding. +#[derive(Debug)] pub struct RefBox<'a, T: 'a> { inner: RefBoxInner<'a, T, Box> } /// Like a RefBox, but encoding from a `str` and decoedes to a `String`. +#[derive(Debug)] pub struct StrBox<'a> { inner: RefBoxInner<'a, str, String> } /// Like a RefBox, but encodes from a `[T]` and encodes to a `Vec`. +#[derive(Debug)] pub struct SliceBox<'a, T: 'a> { inner: RefBoxInner<'a, [T], Vec> } @@ -242,9 +244,3 @@ impl <'a, T> Deref for RefBox<'a, T> { } } } - -impl <'a, T: fmt::Debug> fmt::Debug for RefBox<'a, T> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> { - write!(fmt, "RefBox({:?})", *self) - } -}