rust-no-std
Installation
SKILL.md
Rust no_std
Purpose
Guide agents through #![no_std] Rust development: what core and alloc provide vs std, implementing custom global allocators, panic handler selection for embedded targets, and strategies for testing no_std crates on the host machine.
When to Use
Use this skill when writing or debugging #![no_std] Rust code — library crates for embedded targets, or bare-metal firmware that cannot link against std. For the full embedded development workflow (probe-rs flashing, defmt logging, RTIC), use skills/embedded/embedded-rust. For cross-compilation target setup, use skills/rust/rust-cross. This skill focuses specifically on the no_std / core / alloc boundary and panic handler selection.
Examples
- "I need a parser crate that works without std" → structure with
#![no_std], feature-gate alloc APIs, use borrowed slices for core API - "How do I use Vec in a no_std environment?" → add
allocfeature, provide a global allocator (e.g.,linked-list-allocator), usealloc::vec::Vec - "How do I test my no_std crate on my laptop?" → use
#![cfg_attr(not(test), no_std)]to allow std in test mode, orcargo test --target x86_64-unknown-linux-gnu