Crate microstr

Source
Expand description

§MicroStr — Fixed-capacity stack-allocated string

A lightweight, stack-allocated string type with fixed capacity and UTF-8 support. Designed to work in both std and no_std environments.

§Features

  • No heap allocations: All data is stored on the stack.
  • UTF-8 safe: Guarantees valid UTF-8 content.
  • Fixed capacity: Determined at compile time via const generic CAP.
  • no_std by default: Optional std and serde support via Cargo features.

§Cargo Features

  • std (optional): Enables Display, Debug, From<String>, and other std traits.
  • serde (optional, requires std): Enables JSON serialization/deserialization.

§Example

use microstr::*;

let mut s: MicroStr<16> = MicroStr::new();
s.push_str("Hello");
s.push('!');
assert_eq!(s.as_str(), "Hello!");

Macros§

microstr
Creates a MicroStr containing the string slice.

Structs§

MicroStr
A fixed-capacity, stack-allocated string with UTF-8 support.