soft-ascii-string

soft-ascii-string provides char, str and string wrapper which add 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.
Documentation can be viewed on docs.rs.
Example
extern crate soft_ascii_string;
use ;
Error handling:
extern crate soft_ascii_string;
use ;
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Change Log
v1.0
- added
from_unchecked
toSoftAsciiChar
,SoftAsciiStr
,SoftAsciiString
- deprecated
from_char_unchecked
,from_str_unchecked
,from_string_unchecked
- added