summary refs log tree commit diff
path: root/src/libserialize
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2014-05-04 20:54:02 -0700
committerKevin Ballard <kevin@sb.org>2014-05-08 12:06:22 -0700
commiteab6bb2ece0427d2ec165e510f2abaa84b857900 (patch)
tree09b066f570f067fe927c0cb7cb8b7addf09156c4 /src/libserialize
parent752048a27135bdf15c6f00229b04cea7ceeaf739 (diff)
downloadrust-eab6bb2ece0427d2ec165e510f2abaa84b857900.tar.gz
rust-eab6bb2ece0427d2ec165e510f2abaa84b857900.zip
Handle fallout in documentation
Tweak the tutorial's section on vectors and strings, to slightly clarify
the difference between fixed-size vectors, vectors, and slices.
Diffstat (limited to 'src/libserialize')
-rw-r--r--src/libserialize/json.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 56c0349d9eb..2e4d7696c44 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -166,14 +166,14 @@ use serialize::{json, Encodable, Decodable};
  pub struct TestStruct1  {
     data_int: u8,
     data_str: ~str,
-    data_vector: ~[u8],
+    data_vector: Vec<u8>,
  }
 
 // To serialize use the `json::str_encode` to encode an object in a string.
 // It calls the generated `Encodable` impl.
 fn main() {
     let to_encode_object = TestStruct1
-         {data_int: 1, data_str:"toto".to_owned(), data_vector:~[2,3,4,5]};
+         {data_int: 1, data_str:"toto".to_owned(), data_vector:vec![2,3,4,5]};
     let encoded_str: ~str = json::Encoder::str_encode(&to_encode_object);
 
     // To deserialize use the `json::from_str` and `json::Decoder`
@@ -201,7 +201,7 @@ use collections::TreeMap;
 pub struct TestStruct1  {
     data_int: u8,
     data_str: ~str,
-    data_vector: ~[u8],
+    data_vector: Vec<u8>,
 }
 
 impl ToJson for TestStruct1 {
@@ -218,7 +218,7 @@ fn main() {
     // Serialization using our impl of to_json
 
     let test2: TestStruct1 = TestStruct1 {data_int: 1, data_str:"toto".to_owned(),
-                                          data_vector:~[2,3,4,5]};
+                                          data_vector:vec![2,3,4,5]};
     let tjson: json::Json = test2.to_json();
     let json_str: ~str = tjson.to_str();