Struct andiskaz::string::TermString [−][src]
pub struct TermString { /* fields omitted */ }
Expand description
Graphical string: a string valid to be printed on a terminal for graphic purpouse.
Implementations
Builds a new graphical string.
The string must not start with a diacritic character. Diacritic here is not “^” or “~”, but rather a diacritic that when inserted combines with the previous character. Like the tilde in “ỹ” which can be separated from “y”. On the other hand, the combination “ỹ” is valid and forms a single grapheme cluster. The diacritic is only invalid when separated.
Control characters also trigger an error, because those would allow the terminal to be controlled.
Creates a new TermString
, but replaces error with the replacement
character “�”.
Counts how many grapheme clusters the string contains by iterating the string.
Indexes the string by returning None
if out of bounds. usize
will
return TermGrapheme
s, ranges will return sub-TermString
s.
WARNING: this method is, prefere iterating instead.
Indexes the string by panicking if out of bounds. usize
will
return TermGrapheme
s, ranges will return sub-TermString
s.
WARNING: this method is slow, prefere iterating instead.
pub fn indices(&self) -> TermStringIndices<'_>ⓘNotable traits for TermStringIndices<'tstring>impl<'tstring> Iterator for TermStringIndices<'tstring> type Item = (usize, TermGrapheme);
pub fn indices(&self) -> TermStringIndices<'_>ⓘNotable traits for TermStringIndices<'tstring>impl<'tstring> Iterator for TermStringIndices<'tstring> type Item = (usize, TermGrapheme);
impl<'tstring> Iterator for TermStringIndices<'tstring> type Item = (usize, TermGrapheme);
Iterates over indices and grapheme clusters of this string.
pub fn iter(&self) -> TermStringIter<'_>ⓘNotable traits for TermStringIter<'tstring>impl<'tstring> Iterator for TermStringIter<'tstring> type Item = TermGrapheme;
pub fn iter(&self) -> TermStringIter<'_>ⓘNotable traits for TermStringIter<'tstring>impl<'tstring> Iterator for TermStringIter<'tstring> type Item = TermGrapheme;
impl<'tstring> Iterator for TermStringIter<'tstring> type Item = TermGrapheme;
Iterates only over graphemes of this string.
De-slices a sub-TermString
into the original buffer.
Trait Implementations
Performs the conversion.
Performs the conversion.
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
type Item = TermGrapheme
type Item = TermGrapheme
The type of the elements being iterated over.
type IntoIter = TermStringIter<'tstring>
type IntoIter = TermStringIter<'tstring>
Which kind of iterator are we turning this into?
Returns the display name of this option.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for TermString
impl Send for TermString
impl Sync for TermString
impl Unpin for TermString
impl UnwindSafe for TermString
Blanket Implementations
Mutably borrows from an owned value. Read more