3 releases
| 0.0.3 | Nov 29, 2024 |
|---|---|
| 0.0.2 | Nov 29, 2024 |
| 0.0.1 | Nov 14, 2024 |
#889 in Memory management
387 downloads per month
Used in 45 crates
(3 directly)
7KB
93 lines
A small string type with fixed capacity stored on the stack
Examples
use fixstr::FixStr;
// Create a FixStr with capacity of 16 octets
let tiny: FixStr<16> = FixStr::new("Hello").unwrap();
assert_eq!(tiny.as_str(), "Hello");
assert_eq!(tiny.capacity(), 16);
// FixStr implements common traits
let tiny2: FixStr<16> = "World".try_into().unwrap();
let message: String = tiny2.into();
📦 FixStr
A zero-allocation, fixed-capacity string type that lives entirely on the stack.
🚀 Features
- ✨ Zero heap allocations
- 📏 Configurable fixed capacity
- 🔒 Guaranteed UTF-8 validity
- 🎯 Perfect for small strings
- 🔄 Implements common traits (
Clone,Copy,Debug, etc.)
📥 Installation
Add this to your Cargo.toml:
[dependencies]
fixstr = "0.0.1"
📜 License This project is licensed under the MIT License - see the LICENSE file for details.