macro_rules! string_vec {
() => { ... };
($($x:expr),+ $(,)?) => { ... };
}
Expand description
Create a Vec
of Vec<String>
with string literals.
This macro also allows zero arguments. In this case however, it would be
shorter to call vec![]
or Vec::new()
.
ยงExamples
use string_literals::string_vec;
let old: Vec<String> = vec![String::from("Alice"), String::from("Bob")];
let new: Vec<String> = string_vec!["Alice", "Bob"];
assert_eq!(new.len(), 2);
assert_eq!(new[0], "Alice".to_owned());
assert_eq!(new[1], "Bob".to_owned());