mirror of https://git.sr.ht/~stygianentity/bincode
Merge pull request #31 from jmesmon/me/refbox-debug
refbox: add Debug impl
This commit is contained in:
commit
775df5a971
|
|
@ -1,5 +1,6 @@
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
use rustc_serialize::{Encodable, Encoder};
|
use rustc_serialize::{Encodable, Encoder};
|
||||||
use rustc_serialize::{Decodable, Decoder};
|
use rustc_serialize::{Decodable, Decoder};
|
||||||
|
|
@ -149,3 +150,8 @@ 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ fn test_refbox() {
|
||||||
large_map.insert(1, 2);
|
large_map.insert(1, 2);
|
||||||
|
|
||||||
|
|
||||||
#[derive(RustcEncodable, RustcDecodable)]
|
#[derive(RustcEncodable, RustcDecodable, Debug)]
|
||||||
enum Message<'a> {
|
enum Message<'a> {
|
||||||
M1(RefBox<'a, Vec<u32>>),
|
M1(RefBox<'a, Vec<u32>>),
|
||||||
M2(RefBox<'a, HashMap<u32, u32>>)
|
M2(RefBox<'a, HashMap<u32, u32>>)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue