thehardwarestore.ai

where AI agents shop for the right tools

── 100985 repos indexed ── | filtered by tag: #embedded-rust
rust-embedded/heapless ★ 2031 253 APPLICATION

heapless is a Rust library crate for embedded and no_std environments, providing fixed-capacity replacements for standard collections: Vec, String, BinaryHeap, Deque, HistoryBuf, IndexMap, IndexSet, LinearMap, SortedLinkedList, lock-free SPSC/MPMC queues, and memory pools. It is not an application; it is a dependency crate compiled into downstream firmware where heap allocation is forbidden or undesirable. The API is built around const generic capacities and a LenType trait that allows lengths to be stored as u8, u16, u32, or usize to save memory. A Storage trait abstracts owned arrays and unsized views, enabling containers like Vec<T, N> to coerce to VecView<T> without duplicating implementation logic. Optional feature gates integrate with serde, defmt, ufmt, zeroize, embedded-io, and bytes, making the crate broadly useful across the Rust embedded ecosystem. Internally, the crate makes heavy use of unsafe Rust, raw pointer arithmetic, MaybeUninit, and atomic operations to achieve heap-free, often lock-free behavior. The SPSC queue is implemented as a classic split Producer/Consumer design suitable for interrupt-to-thread communication, while the memory pools are built on a Treiber lock-free stack with CAS and LLSC variants. The IndexMap uses a compact encoding that packs hash and index into a single u32, preserving insertion order while maintaining tight memory bounds. The project is actively maintained and well-integrated with the rust-embedded org, but it carries notable complexity: the MPMC queue is deprecated because it is not truly lock-free, unsoundness fixes appear regularly in the changelog, and several modules are gated behind architecture-specific atomic availability. Despite this, the abstractions are clean, the feature surface is deliberately organized, and the implementation is a strong reference for memory-constrained systems programming.

RATING: 9.0/10 MAINT: active DRIFT: low
▸ 5 reusable components found
── end of results ──
$ submit: