4 releases
0.1.4 | Dec 8, 2021 |
---|---|
0.1.3 |
|
0.1.2 | Dec 8, 2021 |
0.1.1 | Jun 23, 2021 |
0.1.0 | Jun 23, 2021 |
#20 in #insert
9KB
256 lines
qs-rs
let x = 1;
let s = stringify!(
"a" => x,
"b" => 2,
"c" => 3,
"d" => "name age"
);
assert_eq!(s, "a=1&b=2&c=3&d=name+age");
let mut m = BTreeMap::new();
m.insert("a", 1);
m.insert("b", 2);
m.insert("c", 3);
let s = stringify!(m);
assert_eq!(s, "a=1&b=2&c=3");
let s = stringify![
("a", 1),
("b", 2),
("c", 3)
];
assert_eq!(s, "a=1&b=2&c=3");
lib.rs
:
let x = 1;
let y: Option<i32> = None;
let s = stringify!{
"a" => x;
"b" => 2usize;
"c" => 3f64;
"d" => x + 6;
"e" => vec![4i32, 5i32, 6i32];
"f" => "hello world";
"g" => Some(8);
"h" => y
};
assert_eq!(s, "a=1&b=2&c=3&d=7&e[]=4&e[]=5&e[]=6&f=hello%20world");
use std::collections::BTreeMap;
let mut m = BTreeMap::new();
m.insert("a", 1);
m.insert("b", 2);
m.insert("c", 3);
let s = stringify!(m);
assert_eq!(s, "a=1&b=2&c=3");
let s = stringify![
("a", 1),
("b", 2),
("c", 3)
];
assert_eq!(s, "a=1&b=2&c=3");
Dependencies
~16KB