3 releases

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

#914 in Data structures

Download history 68/week @ 2024-11-18 289/week @ 2024-11-25 285/week @ 2024-12-02 272/week @ 2024-12-09 51/week @ 2024-12-16 27/week @ 2024-12-23 115/week @ 2024-12-30 161/week @ 2025-01-06 219/week @ 2025-01-13 55/week @ 2025-01-20 4/week @ 2025-01-27 23/week @ 2025-02-03 28/week @ 2025-02-10 53/week @ 2025-02-17 52/week @ 2025-02-24 114/week @ 2025-03-03

247 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