Crate qs_rs

Source
Expand description
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");

Macros§

Traits§