dynstr

Crates.iodynstr
lib.rsdynstr
version0.1.1
sourcesrc
created_at2020-12-03 14:37:09.583036
updated_at2020-12-04 02:43:16.187724
descriptionA string implementation optimized for manipulations.
homepagehttps://github.com/qti3e/dynstr/
repositoryhttps://github.com/qti3e/dynstr/
max_upload_size
id319290
size49,058
Parsa (qti3e)

documentation

https://docs.rs/dynstr/0.1.1/dynstr/

README

Rust Docs

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.

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

Commit count: 11

cargo fmt