Trait similar::DiffableStr [−][src]
All supported diffable strings.
The text module can work with different types of strings depending
on how the crate is compiled. Out of the box &str
is always supported
but with the bytes
feature one can also work with [u8]
slices for
as long as they are ASCII compatible.
Requires the text
feature.
Required methods
fn tokenize_lines(&self) -> Vec<&Self>
[src]
Splits the value into newlines with newlines attached.
fn tokenize_lines_and_newlines(&self) -> Vec<&Self>
[src]
Splits the value into newlines with newlines separated.
fn tokenize_words(&self) -> Vec<&Self>
[src]
Tokenizes into words.
fn tokenize_chars(&self) -> Vec<&Self>
[src]
Tokenizes the input into characters.
fn tokenize_unicode_words(&self) -> Vec<&Self>
[src]
Tokenizes into unicode words.
fn tokenize_graphemes(&self) -> Vec<&Self>
[src]
Tokenizes into unicode graphemes.
fn as_str(&self) -> Option<&str>
[src]
Decodes the string (potentially) lossy.
fn to_string_lossy(&self) -> Cow<'_, str>
[src]
Decodes the string (potentially) lossy.
fn ends_with_newline(&self) -> bool
[src]
Checks if the string ends in a newline.
fn len(&self) -> usize
[src]
The length of the string.
fn slice(&self, rng: Range<usize>) -> &Self
[src]
Slices the string.
fn as_bytes(&self) -> &[u8]
[src]
Returns the string as slice of raw bytes.
Provided methods
Loading content...Implementations on Foreign Types
impl DiffableStr for str
[src]
fn tokenize_lines(&self) -> Vec<&Self>
[src]
fn tokenize_lines_and_newlines(&self) -> Vec<&Self>
[src]
fn tokenize_words(&self) -> Vec<&Self>
[src]
fn tokenize_chars(&self) -> Vec<&Self>
[src]
fn tokenize_unicode_words(&self) -> Vec<&Self>
[src]
fn tokenize_graphemes(&self) -> Vec<&Self>
[src]
fn as_str(&self) -> Option<&str>
[src]
fn to_string_lossy(&self) -> Cow<'_, str>
[src]
fn ends_with_newline(&self) -> bool
[src]
fn len(&self) -> usize
[src]
fn slice(&self, rng: Range<usize>) -> &Self
[src]
fn as_bytes(&self) -> &[u8]
[src]
impl DiffableStr for [u8]
[src]
Allows viewing ASCII compatible byte slices as strings.
Requires the bytes
feature.