一键导入
rust-ownership
Master Rust ownership, borrowing, lifetimes, and memory safety. Understand move semantics, references, and zero-cost abstractions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Master Rust ownership, borrowing, lifetimes, and memory safety. Understand move semantics, references, and zero-cost abstractions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Master business documentation including BRD, FRD, specifications, and technical documentation for clear communication and requirements management.
Master process modeling with BPMN, flowcharts, swimlane diagrams, and process optimization techniques for business process improvement.
Master requirements gathering techniques including interviews, workshops, observation, and documentation for effective requirement elicitation.
Master use case development with actors, scenarios, preconditions, postconditions, and detailed specifications for comprehensive requirements.
Master data visualization with chart selection, dashboard design, Tableau, Power BI, and effective data storytelling.
Master Excel for data analysis with pivot tables, formulas, Power Query, and advanced Excel techniques.
| name | rust-ownership |
| description | Master Rust ownership, borrowing, lifetimes, and memory safety. Understand move semantics, references, and zero-cost abstractions. |
Master Rust's ownership system for writing safe, efficient, and concurrent code without garbage collection.
fn main() {
let s1 = String::from("hello");
let s2 = s1; // s1 moved to s2, s1 no longer valid
println!("{}", s2); // OK
// println!("{}", s1); // Error: value borrowed after move
}
fn main() {
let s1 = String::from("hello");
let len = calculate_length(&s1); // Borrow s1
println!("Length of '{}' is {}", s1, len); // s1 still valid
}
fn calculate_length(s: &String) -> usize {
s.len()
} // s goes out of scope but nothing happens (doesn't own the data)
fn main() {
let mut s = String::from("hello");
change(&mut s);
println!("{}", s); // "hello, world"
}
fn change(s: &mut String) {
s.push_str(", world");
}
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() {
x
} else {
y
}
}