sew-0.7.8 has been yanked.
Sew
Sew is a Rust library that provides a constant-size string with various manipulation methods, along with other unique string types. It is designed to be used in no_std environments and offers features like serialization, random string generation, and more.
Features
- Constant-Size Strings:
ConStris a fixed-size character string structure that allows for efficient manipulation and querying. - Infallible Strings:
InfallibleStringcan represent both valid and invalid UTF-8 sequences, useful for handling arbitrary byte sequences. - Pattern Searching: Implement custom pattern searching with the
PatternSearchertrait, and more advanced modifications with theGetCharandGetSubStrtraits. - Macros: Easily create
ConStrinstances with thenew_cstr!macro. - Feature Flags:
serde: Enables serialization and deserialization support.rand: Allows for random string generation.expandable: Additional utilities for string manipulation.unsafe_infallible: Provides unsafe mutable access toInfallibleStringvia DerefMut.
Installation
Add sew to your Cargo.toml:
[]
= { = "0.7.7", = ["full_unsafe"] }
Usage
Basic Usage
use new_cstr;
Features
Constant-Size Strings
ConStr provides a variety of methods for string manipulation:
new(): Create a newConStrinitialized with NUL characters.len(): Get the length of theConStr.insert(),remove(),replace(): Modify the string content.to_uppercase(),to_lowercase(): Change the case of the string.
Infallible Strings
InfallibleString can handle both valid and invalid UTF-8 sequences:
new_valid(): Create a validInfallibleString.new_invalid(): Create an invalidInfallibleString.push_str(),push_byte(): Append content to the string.
Pattern Searching
Implement the PatternSearcher trait to define custom pattern matching logic, or GetChar or GetSubStr for advanced modification logic.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is dual licensed under the MIT and Apache 2.0 Licenses.