Crate string_view

Crate string_view 

Source
Expand description

§String View

§Work with views into string slices. Safely extend, reduce without losing parent string size.
§Use in-place modifications to speed up your code

Example:

let program_text = r#"
fn main() {
    let text = "Hello World";
}
"#;
use string_view::StrExt;
 
let mut view = program_text.view_part(0, 0);
view.extend_while(char::is_alphabetic);
view.extend_while(|ch| ch != ' ');
// view.reduce_left_while(char::is_alphabetic); todo!()
assert_eq!(view.as_str(), "fn");

Structs§

BaseStringIsTooShort
The only error case in StringView::try_extend.
Char
In-place character representation inside str slice
CharMut
In-place character representation inside mutable str slice
CharsInPlace
Iterator of chars in-place
CharsInPlaceMut
Mutable iterator of chars in-place
StringView
ViewIsTooShort
The only error case in StringView::try_reduce.

Traits§

StrExt