Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Heapless Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-heapless-knowledge-patch)
---
name: heapless-knowledge-patch
description: heapless
version: "0.9.3"
license: MIT
metadata:
author: Nevaberry
---
# heapless compatibility guidance
Load this skill when migrating heapless code or using collection views,
length types, bounded conversions, queue APIs, and feature configuration.
Use the topic references for complete API names and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Views and length types](references/views-and-lengths.md) | Unsized collection views, length parameters, linked-list index types |
| [Vectors and strings](references/vectors-and-strings.md) | Capacity errors, const capacity, UTF-16, conversions, buffers, C strings |
| [Maps and history](references/maps-and-history.md) | Imports, iterators, positional access, equality, history access and Serde |
| [Queues and linked lists](references/queues-and-lists.md) | MPMC migration and drop behavior, SPSC splitting, list returns, deque traits |
| [Package and target configuration](references/package-and-targets.md) | Yanked release, Cargo features, documentation builds, target support |
## Migration quick reference
### Resolve the yanked release
Cargo normally skips 0.9.0 when resolving a new dependency.
Use a later 0.9.x release for new resolutions.
### Handle capacity errors
The following APIs now return `CapacityError` on capacity failure:
- `String::push`
- `String::push_str`
- `Vec::from_slice`
- `Vec::extend_from_slice`
- `Vec::resize`
- `Vec::resize_default`
Update error matches and functions that propagated `()`.
### Update vector capacity access
Replace `Vec::storage_capacity()` with `capacity()` in runtime code.
`capacity()` is no longer const.
When a const expression needs capacity, use the owned vector's capacity
parameter `N` directly.
### Update map and set imports
Import these names from `heapless::index_map`:
- `FnvIndexMap`, `Bucket`, and `Entry`
- `OccupiedEntry`, `VacantEntry`, and `Pos`
Its iterator types are now `Iter`, `IterMut`, `Keys`, `Values`, and `ValuesMut`.
Import `FnvIndexSet` from `heapless::index_set`, which also provides the
renamed `Iter` type.
### Update history buffer names
Import `HistoryBuf` and `HistoryBufView` from the renamed `history_buf` module.
The storage types are now `OwnedHistoryBufStorage` and `ViewHistoryBufStorage`.
### Update MPMC queue names and aliases
The names changed within `mpmc`:
| Previous name | Current name |
| --- | --- |
| `MpMcQueue` | `Queue` |
| `MpMcQueueView` | `QueueView` |
| `MpMcQueueInner` | `QueueInner` |
Replace imports of `Q2`, `Q4`, `Q8`, `Q16`, `Q32`, and `Q64` with
`mpmc::Queue<T, N>` using the corresponding capacity.
Dropping the queue now drops elements still enqueued.
### Update sorted linked list handling
`SortedLinkedList::pop` now returns `Option<T>` with `None` for an empty list.
Let Rust infer iterator and mutable lookup types where code previously named
`Iter`, `IterInner`, `FindMut`, or `FindMutInner` from `sorted_linked_list`.
### Update UTF-16 error matching
Match malformed input with `FromUtf16Error::DecodeUtf16`, the new name for
the `DecodeUtf16Error` variant.
### Update feature names
Replace Cargo's `defmt-03` feature with `defmt`.
The crate uses defmt 1.0.1.
Replace `doc_auto_cfg` with `doc_cfg` for nightly documentation builds.
## Collection API quick reference
### Accept borrowed collections with different capacities
Unsized views let borrowed APIs accept collections with different fixed
capacities through one parameter type.
Views include `VecView`, `StringView`, `BinaryHeapView`, `LinearMapView`,
`HistoryBufView`, `DequeView`, `SortedLinkedListView`, and `QueueView` in
both `spsc` and `mpmc`.
See [views and length types](references/views-and-lengths.md) for a borrowed
`VecView` example.
### Select length and index types
`Vec`, `VecView`, and `String` accept a trailing `LenT` type parameter.
Choose a length type that can represent the collection's capacity.
`SortedLinkedList` now uses `LenType` for its `Idx` parameter, allowing Rust
to infer the index type.
### Convert vectors and strings
Enable the `alloc` feature to use `TryFrom` in either direction between
`heapless::Vec` and `alloc::vec::Vec`.
An array can initialize a bounded vector directly through `From`.
`String::from_utf16` converts UTF-16 code units into a bounded string.
See [vectors and strings](references/vectors-and-strings.md) for conversion
examples and capacity-error details.
### Work with vector and string buffers
`Vec` and `String` support range removal with `drain`.
`Vec::spare_capacity_mut` gives access to its unused storage.
`Vec<u8, N>` implements `bytes::Buf` and `bytes::BufMut` for use with
byte-buffer APIs.
`heapless::CString` provides fixed-capacity storage for a NUL-terminated
C string.
### Access and compare maps
`IndexMap::get_index` and `get_index_mut` access entries by position.
Use `truncate` to keep only the first entries up to the requested length.
`IndexMap` and `LinearMap` can compare maps with different value types when
the left-hand value type implements `PartialEq` for the right-hand value type.
`LinearMap` implements `IntoIterator` for use in `for` loops.
### Access retained history
Use `oldest`, `oldest_index`, and `recent_index` to locate the ends of the
retained history.
`OldestOrdered` supports reverse iteration.
`HistoryBuf` supports Serde serialization and deserialization.
### Split queues and use deque traits
`spsc::Queue::split` can run in const contexts.
`Deque` implements `Extend`, `PartialEq`, and `Eq`.
## Target configuration quick reference
Pool implementations are available on 64-bit architectures.
`stable_deref_trait` is now a target-dependent dependency.
The crate builds on `thumbv6m-none-eabi` with `portable-atomic` disabled.