Qstr
Rust library providing cache-efficient, stack-allocated string types
Install / Use
/learn @tindzk/QstrREADME
qstr
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
constcontexts - Optional
serdesupport no_stdcompatible- 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.
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
