macro_rules! parameters {
() => { ... };
($text:expr) => { ... };
($($key:expr => $value:expr),+$(,)?) => { ... };
}
Expand description
A macro that creates a new Parameters
instance with the provided key-value pairs.
This macro makes it easy to create a new Parameters
instance without having to call the constructor functions directly. It supports different input formats for creating Parameters
instances with different key-value pairs.
§Usage
parameters!(); // Creates an empty Parameters instance.
§Examples
// Create an empty Parameters instance.
let params = parameters!();
// Create a Parameters instance with the "text" key set to "some text".
let params_with_text = parameters!("some text");
// Create a Parameters instance with multiple key-value pairs.
let params_with_multiple = parameters! {
"key1" => "val1",
"key2" => "val2"
};
§Parameters
()
: Creates an emptyParameters
instance."some text"
: Creates aParameters
instance with the “text” key set to “some text”.{"key1" => "val1", "key2" => "val2"}
: Creates aParameters
instance with the specified key-value pairs.