Skip to content
Back to skills

Heapless Knowledge Patch

ASecurity

heapless

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
developmentrustgoexpressapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill heapless-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Heapless Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Heapless Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-heapless-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-heapless-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: heapless-knowledge-patch
description: heapless
version: "0.9.3"
license: MIT
metadata:
  author: Nevaberry
---


# heapless compatibility guidance

Load this skill when migrating heapless collection APIs, updating Cargo
features, or using collection views, conversions, and buffer access.

## Reference index

| Reference | Topics |
| --- | --- |
| [Vectors and strings](references/vectors-and-strings.md) | Capacity errors, length types, const capacity, UTF-16, conversions, buffer access, C strings |
| [Maps and sets](references/maps-and-sets.md) | Import paths, iterator names, positional access, truncation, equality, iteration |
| [Queues and history](references/queues-and-history.md) | MPMC renames and element drops, const SPSC splitting, history storage, access, serialization |
| [Collection views and traits](references/collection-views-and-traits.md) | Unsized views, sorted linked list index and return types, inferred types, deque traits |
| [Dependencies and targets](references/dependencies-and-targets.md) | Yanked release, Cargo features, documentation builds, target support |

## Migration quick reference

### Dependency resolution

Cargo normally skips the yanked 0.9.0 release when resolving a new dependency.
Use a later 0.9.x release for new resolutions.

### Capacity failures

These methods now return `CapacityError` on capacity failure:

- `String::push` and `String::push_str`.
- `Vec::from_slice` and `Vec::extend_from_slice`.
- `Vec::resize` and `Vec::resize_default`.

Update error matches and functions that propagated `()`.

### Vector capacity in const code

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.

### Map and set imports

Import `FnvIndexMap`, `Bucket`, `Entry`, `OccupiedEntry`, `VacantEntry`,
and `Pos` from `heapless::index_map`.
Its iterator types are now `Iter`, `IterMut`, `Keys`, `Values`, and `ValuesMut`.

Import `FnvIndexSet` from `heapless::index_set`, which also provides the
renamed `Iter` type.

### MPMC queue names and drops

Within `mpmc`, the queue types have these new names:

| Previous name | New 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.

```rust
let queue = heapless::mpmc::Queue::<u8, 8>::new();
```

### History buffer names

Import `HistoryBuf` and `HistoryBufView` from the renamed `history_buf` module.
The storage types are now `OwnedHistoryBufStorage` and `ViewHistoryBufStorage`.

### Sorted linked list return and lookup types

`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`.

### UTF-16 error variant

Match malformed UTF-16 input with `FromUtf16Error::DecodeUtf16`.
This is the new name for the `DecodeUtf16Error` variant.

### Cargo and documentation features

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 views and length types

### Borrow collections of different capacities

Unsized views let borrowed APIs accept collections with different fixed
capacities through one parameter type.

```rust
fn byte_count(bytes: &heapless::VecView<u8>) -> usize {
    bytes.len()
}
```

The views include `VecView`, `StringView`, `BinaryHeapView`, `LinearMapView`,
`HistoryBufView`, `DequeView`, `SortedLinkedListView`, and `QueueView` in both
`spsc` and `mpmc`.

### Choose 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.

```rust
let bytes = heapless::Vec::<u8, 32, u8>::new();
let text = heapless::String::<32, u8>::new();
```

`SortedLinkedList` now uses `LenType` for its `Idx` parameter, allowing Rust
to infer the index type.

## Conversion and buffer quick reference

### Convert allocated vectors

Enable the `alloc` feature to use `TryFrom` in either direction between
`heapless::Vec` and `alloc::vec::Vec`.

```rust
extern crate alloc;
let allocated = alloc::vec![1_u8, 2, 3];
let bounded = heapless::Vec::<u8, 8>::try_from(allocated).unwrap();
let allocated_again = alloc::vec::Vec::try_from(bounded).unwrap();
```

### Initialize from an array

An array can initialize a bounded vector directly through `From`.

```rust
let bytes: heapless::Vec<u8, 3> = [1, 2, 3].into();
```

### Access and remove buffer contents

`Vec` and `String` support range removal with `drain`.
`Vec::spare_capacity_mut` gives access to unused storage.
`Vec<u8, N>` implements `bytes::Buf` and `bytes::BufMut` for byte-buffer APIs.

### Convert UTF-16 and store C strings

`String::from_utf16` converts UTF-16 code units into a bounded string.
`heapless::CString` provides fixed-capacity storage for a NUL-terminated C string.

## Collection access quick reference

`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.

Use `oldest`, `oldest_index`, and `recent_index` to locate the ends of retained
history. `OldestOrdered` supports reverse iteration, and `HistoryBuf` supports
Serde serialization and deserialization.

`spsc::Queue::split` can run in const contexts.
`Deque` implements `Extend`, `PartialEq`, and `Eq`.
`LinearMap` implements `IntoIterator` for use in `for` loops.

## Target support 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.

Files in this skill

  • SKILL.md6 KB
  • coverage.json319 B
  • references/collection-views-and-traits.md1021 B
  • references/dependencies-and-targets.md698 B
  • references/maps-and-sets.md874 B
  • references/queues-and-history.md1 KB
  • references/vectors-and-strings.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.