macro_rules! headers { ($($name:expr => $value:expr $(,)?)*) => { ... }; }
Expand description
A quick way to create a header HashMap.
A similar version of this macro can be found in other
crates as map!
or hashmap!
.
This will convert any $value
to a String, since
the headers are stored as HashMap<&str, String>
.
Example:
use snowboard::headers;
let headers = headers! {
"Content-Type" => "text/html",
"X-Hello" => "World!",
"X-Number" => 42,
};