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.
§Benchmarks
See section Benchmarks of the README for this repository.
§Examples
use flexible_string::FlexibleString;
let mut string = FlexibleString::<250>::from("hello");
string.push(',');
string.push_str("world");
assert_eq!(string, "hello,world");Structs§
- Flexible
String - A stack heap flexible string, which first uses a fixed size stack buffer of
CAPACITYbytes and automatically upgrades to a heap buffer (String) when more space is needed. - From
Utf8 Error - A possible error value when converting a
FlexibleStringfrom a UTF-8 byte vector.