| Crates.io | sew |
| lib.rs | sew |
| version | 0.7.9 |
| created_at | 2025-02-16 21:18:10.152614+00 |
| updated_at | 2025-02-23 04:16:46.067364+00 |
| description | Weird strings |
| homepage | |
| repository | https://github.com/barely-a-dev/sew |
| max_upload_size | |
| id | 1558149 |
| size | 89,100 |
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.
ConStr is a fixed-size character string structure that allows for efficient manipulation and querying.InfallibleString can represent both valid and invalid UTF-8 sequences, useful for handling arbitrary byte sequences.PatternSearcher trait, and more advanced modifications with the GetChar and GetSubStr traits.ConStr instances with the new_cstr! macro.serde: Enables serialization and deserialization support.rand: Allows for random string generation.expandable: Additional utilities for string manipulation.unsafe_infallible: Provides unsafe mutable access to InfallibleString via DerefMut.Add sew to your Cargo.toml:
[dependencies]
sew = { version = "0.7.7", features = ["full_unsafe"] }
use sew::helpers::new_cstr;
fn main() {
let x = new_cstr!("Hello, World!");
println!("{}", x);
}
ConStr provides a variety of methods for string manipulation:
new(): Create a new ConStr initialized with NUL characters.len(): Get the length of the ConStr.insert(), remove(), replace(): Modify the string content.to_uppercase(), to_lowercase(): Change the case of the string.InfallibleString can handle both valid and invalid UTF-8 sequences:
new_valid(): Create a valid InfallibleString.new_invalid(): Create an invalid InfallibleString.push_str(), push_byte(): Append content to the string.Implement the PatternSearcher trait to define custom pattern matching logic, or GetChar or GetSubStr for advanced modification logic.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is dual licensed under the MIT and Apache 2.0 Licenses.