← All skills
Tencent SkillHub Β· AI

Rust

Write idiomatic Rust avoiding ownership pitfalls, lifetime confusion, and common borrow checker battles.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Write idiomatic Rust avoiding ownership pitfalls, lifetime confusion, and common borrow checker battles.

⬇ 0 downloads β˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
SKILL.md, advanced-traps.md, concurrency-memory.md, errors-iteration.md, ownership-borrowing.md, types-strings.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.1

Documentation

ClawHub primary doc Primary doc: SKILL.md 11 sections Open source page

Quick Reference

TopicFileKey TrapOwnership & Borrowingownership-borrowing.mdMove semantics catch everyoneStrings & Typestypes-strings.mdString vs &str, UTF-8 indexingErrors & Iterationerrors-iteration.mdunwrap() in production, lazy iteratorsConcurrency & Memoryconcurrency-memory.mdRc not Send, RefCell panicsAdvanced Trapsadvanced-traps.mdunsafe, macros, FFI, performance

Ownership β€” #1 Source of Compiler Errors

Variable moved after use β€” clone explicitly or borrow with & for item in vec moves vec β€” use &vec or .iter() to borrow String moved into function β€” pass &str for read-only access

Borrowing β€” The Borrow Checker Always Wins

Can't have &mut and & simultaneously β€” restructure or interior mutability Returning reference to local fails β€” return owned value instead Mutable borrow through &mut self blocks all access β€” split struct or RefCell

Lifetimes β€” When Compiler Can't Infer

'static means CAN live forever, not DOES β€” String is 'static capable Struct with reference needs <'a> β€” struct Foo<'a> { bar: &'a str } Function returning ref must tie to input β€” fn get<'a>(s: &'a str) -> &'a str

Strings β€” UTF-8 Surprises

s[0] doesn't compile β€” use .chars().nth(0) or .bytes() .len() returns bytes, not chars β€” use .chars().count() s1 + &s2 moves s1 β€” use format!("{}{}", s1, s2) to keep both

Error Handling β€” Production Code

unwrap() panics β€” use ? or match in production ? needs Result/Option return type β€” main needs -> Result<()> expect("context") > unwrap() β€” shows why it panicked

Iterators β€” Lazy Evaluation

.iter() borrows, .into_iter() moves β€” choose carefully .collect() needs type β€” collect::<Vec<_>>() or typed binding Iterators are lazy β€” nothing runs until consumed

Concurrency β€” Thread Safety

Rc is NOT Send β€” use Arc for threads Mutex lock returns guard β€” auto-unlocks on drop, don't hold across await RwLock deadlock β€” reader upgrading to writer blocks forever

Memory β€” Smart Pointers

RefCell panics at runtime β€” if borrow rules violated Box for recursive types β€” compiler needs known size Avoid Rc<RefCell<T>> spaghetti β€” rethink ownership

Common Compiler Errors (NEW)

ErrorCauseFixvalue moved hereUsed after moveClone or borrowcannot borrow as mutableAlready borrowedRestructure or RefCellmissing lifetime specifierAmbiguous referenceAdd <'a>the trait bound X is not satisfiedMissing implCheck trait boundstype annotations neededCan't inferTurbofish or explicit typecannot move out of borrowed contentDeref movesClone or pattern match

Cargo Traps (NEW)

cargo update updates Cargo.lock, not Cargo.toml β€” manual version bump needed Features are additive β€” can't disable a feature a dependency enables [dev-dependencies] not in release binary β€” but in tests/examples cargo build --release much faster β€” debug builds are slow intentionally

Category context

Agent frameworks, memory systems, reasoning layers, and model-native orchestration.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
6 Docs
  • SKILL.md Primary doc
  • advanced-traps.md Docs
  • concurrency-memory.md Docs
  • errors-iteration.md Docs
  • ownership-borrowing.md Docs
  • types-strings.md Docs