Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qti3e/dynstr
A string implementation optimized for manipulations.
https://github.com/qti3e/dynstr
Last synced: about 1 month ago
JSON representation
A string implementation optimized for manipulations.
- Host: GitHub
- URL: https://github.com/qti3e/dynstr
- Owner: qti3e
- Created: 2020-12-03T14:38:33.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-04T02:48:34.000Z (about 4 years ago)
- Last Synced: 2024-11-17T12:06:24.449Z (about 2 months ago)
- Language: Rust
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Rust](https://github.com/qti3e/dynstr/workflows/Rust/badge.svg)](https://github.com/qti3e/dynstr)
[![Docs](https://docs.rs/dynstr/badge.svg)](https://docs.rs/dynstr)# dynstr
This crate provides an `String` implementation which is optimized for string-manipulations,
such as concatenating and slicing.It is suited for situations where there are lots of dynamic concatenating and slicing such
as, but not limited to, Parsers, Interpreters, Template Engines and more.## Example
Event though this example doesn't actually improve the performance (even decreases it), it
can demonstrate the basic usage of this library.
```rust
use dynstr::DynamicString;fn main() {
let s0 = DynamicString::new("Hello");
let s1 = DynamicString::new("World");
let con: DynamicString = s0 + " " + s1;
println!("{}", con);
let hello = con.slice(0, 5);
assert_eq!(hello, "Hello");
}
```Note: Any string that has less than 16 bytes is flattened.
(Gets copied instead of being referenced.)License: MIT