简介
在本实验中,我们将探索 Rust 中 super
和 self
关键字的用法,以消除访问项时的歧义并避免硬编码路径。
注意:如果实验未指定文件名,你可以使用任何你想要的文件名。例如,你可以使用
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(("Rust")) -.-> rust/DataStructuresandEnumsGroup(["Data Structures and Enums"])
rust/DataTypesGroup -.-> rust/type_casting("Type Conversion and Casting")
rust/FunctionsandClosuresGroup -.-> rust/function_syntax("Function Syntax")
rust/FunctionsandClosuresGroup -.-> rust/expressions_statements("Expressions and Statements")
rust/MemorySafetyandManagementGroup -.-> rust/lifetime_specifiers("Lifetime Specifiers")
rust/DataStructuresandEnumsGroup -.-> rust/method_syntax("Method Syntax")
subgraph Lab Skills
rust/type_casting -.-> lab-99335{{"Super 和 Self"}}
rust/function_syntax -.-> lab-99335{{"Super 和 Self"}}
rust/expressions_statements -.-> lab-99335{{"Super 和 Self"}}
rust/lifetime_specifiers -.-> lab-99335{{"Super 和 Self"}}
rust/method_syntax -.-> lab-99335{{"Super 和 Self"}}
end