Skip to main content

Module heapless_08

Module heapless_08 

Source
Available on crate feature heapless-08 only.
Expand description

Fixed-capacity strings using heapless 0.8.

Available with the heapless-08 feature, independently of alloc or std. These functions return heapless::String values with inline storage and report insufficient capacity as an error. Capacity counts encoded ASCII characters: storing N input bytes requires at least 2 * N characters.

The exposed dependency type is always from heapless 0.8. Support for an incompatible dependency version uses a separate module and feature; enabling heapless support does not change the allocated string APIs.

§Examples

use faster_hex::heapless_08;

let id = heapless_08::hex_string::<8>(&[0x12, 0xab, 0, 0xff])?;
assert_eq!(id.as_str(), "12ab00ff");

Functions§

hex_string
Encodes src as a lowercase hexadecimal string with inline capacity N.
hex_string_upper
Encodes src as an uppercase hexadecimal string with inline capacity N.