Module strings

Module strings 

Source

Macros§

format_compact
Creates a CompactString using interpolation of runtime expressions.

Structs§

CompactString
A CompactString is a compact string type that can be used almost anywhere a String or str can be used.

Constants§

DOT_STR
EMPTY_STRING
EMPTY_STRING_OPTION
READABLE_ASCII

Traits§

AsStr
CompactStringExt
A trait that provides convenience methods for creating a CompactString from a collection of items. It is implemented for all types that can be converted into an iterator, and that iterator yields types that can be converted into a str.
RUMArrayConversions
RUMStringConversions
StringUtils
ToCompactString
A trait for converting a value to a CompactString.
UTFStringExtensions
Implemented indexing trait for String and str which uses the UnicodeSegmentation facilities to enable grapheme iteration by default. There could be some performance penalty, but it will allow for native Unicode support to the best extent possible.

Functions§

basic_escape
Escape UTF-8 characters in UTF-8 string that are beyond ascii range
count_tokens_ignoring_pattern
escape
Turn UTF-8 character into escaped character sequence as expected in HL7
filter_ascii
Removes all non ASCII and all non printable characters from string.
filter_non_printable_ascii
Removes all non ASCII and all non printable characters from string.
get_grapheme_collection
Return vector of graphemes from starting spot up until we find the end grapheme.
get_grapheme_string
Get the grapheme block and concatenate it into a newly allocated RUMString.
is_ascii_str
Checks if a given string is fully ASCII or within the ASCII range.
is_escaped_str
Checks if an input string is already escaped. The idea is to avoid escaping the escaped string thus making it a nightmare to undo the escaping later on.
is_printable_char
Returns whether a character is in the ASCII printable range.
try_decode
Implements decoding this string from its auto-detected encoding to UTF-8. Failing that we assume the string was encoded in UTF-8 and return a copy.
try_decode_with
Implements decoding this string from a specific encoding to UTF-8.
unescape
Turn escaped character sequence into the equivalent UTF-8 character This function accepts \o, \x and \u formats. This function will also attempt to unescape the common C style control characters. Anything else needs to be expressed as hex or octal patterns with the formats above.
unescape_string
This function will scan through an escaped string and unescape any escaped characters. We collect these characters as a byte vector. Finally, we do a decode pass on the vector to re-encode the bytes hopefully right into a valid UTF-8 string.

Type Aliases§

RUMString