简介
在本实验中,你将学习如何使用 macro_rules!
语法在 Rust 中重载宏,使它们能够接受不同的参数组合。
注意:如果实验未指定文件名,你可以使用任何你想要的文件名。例如,你可以使用
main.rs
,通过rustc main.rs &&./main
进行编译和运行。
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
rust(("Rust")) -.-> rust/DataTypesGroup(["Data Types"])
rust(("Rust")) -.-> rust/FunctionsandClosuresGroup(["Functions and Closures"])
rust(("Rust")) -.-> rust/MemorySafetyandManagementGroup(["Memory Safety and Management"])
rust/DataTypesGroup -.-> rust/boolean_type("Boolean Type")
rust/FunctionsandClosuresGroup -.-> rust/function_syntax("Function Syntax")
rust/FunctionsandClosuresGroup -.-> rust/expressions_statements("Expressions and Statements")
rust/MemorySafetyandManagementGroup -.-> rust/lifetime_specifiers("Lifetime Specifiers")
subgraph Lab Skills
rust/boolean_type -.-> lab-99226{{"使用 macro_rules! 重载 Rust 宏"}}
rust/function_syntax -.-> lab-99226{{"使用 macro_rules! 重载 Rust 宏"}}
rust/expressions_statements -.-> lab-99226{{"使用 macro_rules! 重载 Rust 宏"}}
rust/lifetime_specifiers -.-> lab-99226{{"使用 macro_rules! 重载 Rust 宏"}}
end