Crate soft_ascii_string

Source
Expand description

This crate provides char, str and string wrappers which have an “is-ascii” soft constraint.

As it is a soft constraint it can be violated, while a violation is (normally) a bug it does not introduce any safety issues. In this soft-ascii-string differs to e.g. ascii which uses a hard constraint and where a violation does brake rust safety and potentially introduces undefined behavior.

Soft-ascii-string is suited for situations where many places (e.g. external libraries) output strings which should be ascii and which you do not want to iterate over to assure they are ascii but where you neither want to use a unsafe conversions as it would be required by the ascii crate.

This crate is not necessarily suited if you want to rally on the string being ascii on a safety level, you might want to consider using ascii in that case.

Modules§

error

Structs§

SoftAsciiChar
a char wrapper with a “is us-ascii” soft constraint
SoftAsciiCharIndices
a wrapper around CharsIndices turning each char into a SoftAsciiChar
SoftAsciiChars
a wrapper around Chars turning each char into a SoftAsciiChar
SoftAsciiLines
a wrapper around Lines turning each line into a SoftAsciiStr
SoftAsciiSplitWhitespace
a wrapper around SplitWhitespace turning each section into a SoftAsciiStr
SoftAsciiStr
A str wrapper adding a “is us-ascii” soft constraint.
SoftAsciiString
a String wrapper with an additional “is us-ascii” soft constraint