Expand description

A stack heap flexible string designed to improve performance.

FlexibleString has a fixed stack buffer of the given bytes, and automatically upgrades to String when more space is needed. It provides APIs that are as consistent as possible with String, but some APIs are not yet implemented or cannot be implemented.

FlexibleString was first implemented in spdlog-rs crate, which improved performance for spdlog-rs by about double (see benchmarks of spdlog-rs). Now it is extracted to a separate crate for use by other crates.


See section Benchmarks of the README for this repository.


use flexible_string::FlexibleString;

let mut string = FlexibleString::<250>::from("hello");
assert_eq!(string, "hello,world");


A stack heap flexible string, which first uses a fixed size stack buffer of CAPACITY bytes and automatically upgrades to a heap buffer (String) when more space is needed.

A possible error value when converting a FlexibleString from a UTF-8 byte vector.