summaryrefslogtreecommitdiff
path: root/examples/introduction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/introduction.rs')
-rw-r--r--examples/introduction.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/examples/introduction.rs b/examples/introduction.rs
index 9d949b4..66283d3 100644
--- a/examples/introduction.rs
+++ b/examples/introduction.rs
@@ -38,7 +38,7 @@ fn main() {
city: "Carrot City".to_string(),
postcode: "12345".to_string(),
},
- user_ids: vec!(1,2,3,4),
+ user_ids: vec![1, 2, 3, 4],
};
// Naive approach: manually parameters in a map. Painful.
@@ -80,19 +80,18 @@ fn main() {
let encoded2 = qs::to_string(&params).unwrap();
assert_eq!(encoded, encoded2);
- // An advantage of `serde_qs` for deserializing, is that it is robust against
- // different orderings of inputs:
+ // An advantage of `serde_qs` for deserializing, is that it is robust
+ // against different orderings of inputs:
- let mut inputs = vec!["id=42",
- "name=Acme",
- "phone=12345",
- "address[city]=Carrot+City",
- "address[postcode]=12345",
- "user_ids[0]=1",
- "user_ids[1]=2",
- "user_ids[2]=3",
- "user_ids[3]=4"
- ];
+ let mut inputs = vec!["id=42",
+ "name=Acme",
+ "phone=12345",
+ "address[city]=Carrot+City",
+ "address[postcode]=12345",
+ "user_ids[0]=1",
+ "user_ids[1]=2",
+ "user_ids[2]=3",
+ "user_ids[3]=4"];
let mut rng = rand::thread_rng();
for _ in 0..10 {
@@ -128,4 +127,4 @@ fn main() {
user_ids[512]=4";
let params: QueryParams = qs::from_str(encoded).unwrap();
assert_eq!(params, example_params);
-} \ No newline at end of file
+}