Module andiskaz::string [−][src]
Expand description
This module provides a string type used to be printed to the terminal. It is
called “TermString
”. You can use the macro tstring!
to build a
TermString
as a shortcut for TermString::new_lossy
.
This module also provides a type TermGrapheme
, which corresponds to what
a human sees as a single character (“grapheme cluster”). It might be
composed of a single unicode codepoint or of several. However,
TermGrapheme
s made of several characters are not portable, as Windows’
cmd
by default prints the multiple characters of a grapheme separatedly,
while most Linux ANSI terminals will print them together if they form a
single grapheme cluster.
To concat TermString
s and TermGrapheme
s together you can use the
macro tstring_concat!
.
Structs
Error generated when validating a TermString
or a grapheme
(TermGrapheme
) and the string starts with a
diacrtic.
Error generated when validating a TermString
and the string contains a
control byte.
Error generated when validating a grapheme
(TermGrapheme
) and the string does not
containing exactly one grapheme cluster
(TermGrapheme
).
A grapheme cluster. Represents what a human visually sees as a character.
Graphical string: a string valid to be printed on a terminal for graphic purpouse.
Iterator over the TermString
’s grapheme cluster (TermGrapheme
)s
indices and over the grapheme cluster (TermGrapheme
)s themselves.
Iterator only over the grapheme cluster (TermGrapheme
)s of a
TermString
.
Enums
Either a string or a grapheme reference. Used by tstring_concat!
.
Possible errors when creating a
TermGrapheme
.
Possible errors when creating a
TermGrapheme
.
Traits
Specifies usable indices for a TermString
.