heapless provides stack-allocated versions of common data structures. The capacity is a const generic — fixed at compile time, stored inline, no allocator needed.

use heapless::Vec;
use heapless::spsc::Queue;

// Stack-allocated Vec, max 32 elements
let mut frames: Vec<CanFrame, 32> = Vec::new();

// Lock-free single-producer single-consumer queue
// Safe to use between main and interrupt context
static Q: Queue<u8, 128> = Queue::new();

The spsc::Queue is the most important type for embedded use: it is a lock-free ring buffer safe to split into producer/consumer halves across interrupt boundaries. Used extensively in SpaceCAN for passing frames between the CAN interrupt handler and the protocol stack running in main.

Key constraint: if you try to push to a full Vec, it returns Err. You must handle this — there is no panic-on-allocation-fail in no_std. This constraint forces you to think about worst-case buffer occupancy at design time, not at runtime.