about summary refs log tree commit diff
path: root/src/libserialize
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-22 11:28:01 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-27 21:44:51 -0700
commitb53454e2e413ac58da20933968cb4a86a3c7c476 (patch)
tree049f02aae3a1c7be395a3b7467ae31af92def081 /src/libserialize
parent911cc9c35234ab12a4b9a6fc1cb35b52556f242d (diff)
downloadrust-b53454e2e413ac58da20933968cb4a86a3c7c476.tar.gz
rust-b53454e2e413ac58da20933968cb4a86a3c7c476.zip
Move std::{reflect,repr,Poly} to a libdebug crate
This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add `extern crate debug;` to the top of the
crate. Any code relying on reflection will also need to do this.

Closes #12019

[breaking-change]
Diffstat (limited to 'src/libserialize')
-rw-r--r--src/libserialize/ebml.rs13
-rw-r--r--src/libserialize/hex.rs2
-rw-r--r--src/libserialize/json.rs10
3 files changed, 13 insertions, 12 deletions
diff --git a/src/libserialize/ebml.rs b/src/libserialize/ebml.rs
index e6fe57006ca..a127c11f509 100644
--- a/src/libserialize/ebml.rs
+++ b/src/libserialize/ebml.rs
@@ -44,6 +44,7 @@ pub struct TaggedDoc<'a> {
     pub doc: Doc<'a>,
 }
 
+#[deriving(Show)]
 pub enum EbmlEncoderTag {
     EsUint,     // 0
     EsU64,      // 1
@@ -323,7 +324,7 @@ pub mod reader {
         }
 
         fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<Doc<'doc>> {
-            debug!(". next_doc(exp_tag={:?})", exp_tag);
+            debug!(". next_doc(exp_tag={})", exp_tag);
             if self.pos >= self.parent.end {
                 return Err(Expected(format_strbuf!("no more documents in \
                                                     current node!")));
@@ -339,8 +340,8 @@ pub mod reader {
                    r_doc.end);
             if r_tag != (exp_tag as uint) {
                 return Err(Expected(format_strbuf!("expected EBML doc with \
-                                                    tag {:?} but found tag \
-                                                    {:?}",
+                                                    tag {} but found tag \
+                                                    {}",
                                                    exp_tag,
                                                    r_tag)));
             }
@@ -370,7 +371,7 @@ pub mod reader {
 
         fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<uint> {
             let r = doc_as_u32(try!(self.next_doc(exp_tag)));
-            debug!("_next_uint exp_tag={:?} result={}", exp_tag, r);
+            debug!("_next_uint exp_tag={} result={}", exp_tag, r);
             Ok(r as uint)
         }
 
@@ -1085,7 +1086,7 @@ mod tests {
     #[test]
     fn test_option_int() {
         fn test_v(v: Option<int>) {
-            debug!("v == {:?}", v);
+            debug!("v == {}", v);
             let mut wr = MemWriter::new();
             {
                 let mut ebml_w = writer::Encoder(&mut wr);
@@ -1094,7 +1095,7 @@ mod tests {
             let ebml_doc = reader::Doc(wr.get_ref());
             let mut deser = reader::Decoder(ebml_doc);
             let v1 = Decodable::decode(&mut deser).unwrap();
-            debug!("v1 == {:?}", v1);
+            debug!("v1 == {}", v1);
             assert_eq!(v, v1);
         }
 
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index e72de88a06b..373bff8b0cc 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -95,7 +95,7 @@ impl<'a> FromHex for &'a str {
      *     let hello_str = "Hello, World".as_bytes().to_hex();
      *     println!("{}", hello_str);
      *     let bytes = hello_str.as_slice().from_hex().unwrap();
-     *     println!("{:?}", bytes);
+     *     println!("{}", bytes);
      *     let result_str = String::from_utf8(bytes).unwrap();
      *     println!("{}", result_str);
      * }
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 4375e65891b..08ac66959bc 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -1906,7 +1906,7 @@ impl ::Decoder<DecoderError> for Decoder {
                             names: &[&str],
                             f: |&mut Decoder, uint| -> DecodeResult<T>)
                             -> DecodeResult<T> {
-        debug!("read_enum_variant(names={:?})", names);
+        debug!("read_enum_variant(names={})", names);
         let name = match self.pop() {
             String(s) => s,
             Object(mut o) => {
@@ -1961,7 +1961,7 @@ impl ::Decoder<DecoderError> for Decoder {
                                    names: &[&str],
                                    f: |&mut Decoder, uint| -> DecodeResult<T>)
                                    -> DecodeResult<T> {
-        debug!("read_enum_struct_variant(names={:?})", names);
+        debug!("read_enum_struct_variant(names={})", names);
         self.read_enum_variant(names, f)
     }
 
@@ -3013,7 +3013,7 @@ mod tests {
         let bytes = mem_buf.unwrap();
         let json_str = from_utf8(bytes.as_slice()).unwrap();
         match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
+            Err(_) => fail!("Unable to parse json_str: {}", json_str),
             _ => {} // it parsed and we are good to go
         }
     }
@@ -3033,7 +3033,7 @@ mod tests {
         let bytes = mem_buf.unwrap();
         let json_str = from_utf8(bytes.as_slice()).unwrap();
         match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
+            Err(_) => fail!("Unable to parse json_str: {}", json_str),
             _ => {} // it parsed and we are good to go
         }
     }
@@ -3043,7 +3043,7 @@ mod tests {
         use Decodable;
         let json_str = "{\"1\":true}";
         let json_obj = match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
+            Err(_) => fail!("Unable to parse json_str: {}", json_str),
             Ok(o) => o
         };
         let mut decoder = Decoder::new(json_obj);