#string #optimization #display #inline #no-heap

smart-string

A collection of string types and traits designed for enhanced string manipulation

3 releases

0.1.3 Sep 21, 2023
0.1.2 Sep 20, 2023
0.1.1 Sep 19, 2023

#779 in Rust patterns

Download history 10/week @ 2024-06-16 29/week @ 2024-06-23 4/week @ 2024-06-30 11/week @ 2024-07-07 5/week @ 2024-07-14 29/week @ 2024-07-21 16/week @ 2024-07-28 23/week @ 2024-08-04 31/week @ 2024-08-11 24/week @ 2024-08-18 20/week @ 2024-08-25 3/week @ 2024-09-01 18/week @ 2024-09-22 36/week @ 2024-09-29

54 downloads per month

MIT/Apache

45KB
1K SLoC

crates.io

Minimal rust version 1.56 (sorry, not checked yet)

Smart String Library

This library is a collection of string types and traits designed for enhanced string manipulation. It's born out of a need to centralize and avoid code repetition, particularly unsafe operations, from the author's previous projects. While the tools and methods here reflect certain patterns frequently observed in those projects, it's worth noting that the library itself is in its early stages of development.

Status

Currently, Smart String is in active development, and its API might undergo changes. Although it encapsulates tried-and-true patterns from earlier works, the library as a standalone entity is relatively new. Hence, it's advised to use it with caution and feel free to provide feedback, report issues, or suggest improvements.

Not yet covered by tests.

Features

  • serde - Enables serde support.

What's in the box

  • PascalString<N>: A string with a fixed capacity, either stored on the stack or in-place within larger structures and arrays.
  • DisplayExt: A suite of methods to streamline string formatting.
  • SmartString: A string that dynamically decides its storage location (stack or heap) based on its length.

Roadmap

Primary Goals

  • StringsStack: A dedicated storage solution for multiple strings, allowing them to be housed within a single allocation.
  • StringsSet: A storage medium designed for strings, facilitating both consolidated allocation and utilization as a hash set.

Additional Goals

  • PascalStringLong<N>: An enhanced variant of PascalString<N> offering support for capacities up to 2^32-1 bytes, catering to scenarios where a 255-byte limit falls short.
  • Compatibility with no_std environments.
  • Integration support for ufmt.

Open to more suggestions!

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~110–340KB