qstr

Crates.ioqstr
lib.rsqstr
version0.2.0
created_at2025-11-10 09:17:06.443422+00
updated_at2025-12-01 15:42:17.73612+00
descriptionCache-efficient, stack-allocated string types
homepage
repositoryhttps://github.com/tindzk/qstr
max_upload_size
id1925002
size54,675
Tim Nieradzik (tindzk)

documentation

README

qstr

Crates.io Docs.rs Licence Build Status no_std Minimum Rust Version

qstr is a small, no_std Rust library providing cache-efficient, stack-allocated string types.

It is suitable for embedded environments, WebAssembly, parsers and other peformance-sensitive contexts.

Motivation

In many cases, string lengths are bounded and their maximum size is known in advance. Storing such strings on the stack eliminates allocator overhead and improves cache locality.

Because qstr types implement Copy, they can be passed by value without cloning.

This library provides types for common sizes, optimised for cache-line efficiency.

Features

  • Stack-allocated string types
    • Variable-length strings with fixed capacity
    • Fixed-length strings
    • Fixed-capacity string vectors
  • All types implement Copy
  • Usable in const contexts
  • Optional serde support
  • no_std compatible
  • Zero dependencies

Example

use qstr::BStr15;
use qstr::StrVec;
use qstr::Align16;

let str: BStr15 = "aws:us:east:1".into();
let vec: StrVec<u16, 15, Align16> = str.split(":");

assert_eq!(
  vec.iter().collect::<Vec<_>>(),
  vec!["aws", "us", "east", "1"]
);

Licence

qstr is licensed under the terms of the Apache License, Version 2.0.

Commit count: 0

cargo fmt