3 releases

0.0.3 Nov 29, 2024
0.0.2 Nov 29, 2024
0.0.1 Nov 14, 2024

#816 in Memory management

Download history 161/week @ 2024-11-13 61/week @ 2024-11-20 438/week @ 2024-11-27 202/week @ 2024-12-04

862 downloads per month
Used in 35 crates (3 directly)

MIT license

7KB
93 lines

📦 FixStr

A zero-allocation, fixed-capacity string type that lives entirely on the stack.

Crates.io Documentation

🚀 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.


lib.rs:

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();

No runtime deps