std_macro_extensions/vector/macro.rs
1/// Creates a new `Vec` instance.
2///
3/// This macro can be used in two forms:
4/// - Without arguments, it creates an empty `Vec`.
5/// - With elements, it creates a `Vec` initialized with the provided elements.
6#[macro_export]
7macro_rules! vector {
8 () => {
9 std::vec::Vec::new()
10 };
11 ($($elem:expr),*) => {
12 std::vec::Vec::from([$($elem),*])
13 };
14}