Initial commit
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "demo"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,31 @@
|
||||
// Declarative macros
|
||||
|
||||
// macro_rules! custom_vec {
|
||||
// ( $( $x:expr ),* ) => {
|
||||
// {
|
||||
// let mut temp_vec = Vec::new();
|
||||
// $(
|
||||
// temp_vec.push($x);
|
||||
// )*
|
||||
// temp_vec
|
||||
// }
|
||||
// };
|
||||
// // ( $( $x:expr ),*; mult = $mult:expr ) => {
|
||||
// // custom_vec![$( $x * $mult ),*]
|
||||
// // };
|
||||
// }
|
||||
|
||||
fn main() {
|
||||
let mut a = Vec::new();
|
||||
a.push(1);
|
||||
a.push(2);
|
||||
a.push(3);
|
||||
|
||||
// let a = vec![1, 2, 3];
|
||||
|
||||
// let a = custom_vec!(1, 2, 3);
|
||||
|
||||
// let a = custom_vec!(1, 2, 3; mult = 2);
|
||||
|
||||
println!("{a:?}");
|
||||
}
|
||||
Reference in New Issue
Block a user