| 1 | # ascii |
| 2 | |
| 3 | A library that provides ASCII-only string and character types, equivalent to the |
| 4 | `char`, `str` and `String` types in the standard library. |
| 5 | |
| 6 | Types and conversion traits are described in the [Documentation](https://docs.rs/ascii). |
| 7 | |
| 8 | You can include this crate in your cargo project by adding it to the |
| 9 | dependencies section in `Cargo.toml`: |
| 10 | |
| 11 | ```toml |
| 12 | [dependencies] |
| 13 | ascii = "1.1" |
| 14 | ``` |
| 15 | |
| 16 | ## Using ascii without libstd |
| 17 | |
| 18 | Most of `AsciiChar` and `AsciiStr` can be used without `std` by disabling the |
| 19 | default features. The owned string type `AsciiString` and the conversion trait |
| 20 | `IntoAsciiString` as well as all methods referring to these types can be |
| 21 | re-enabled by enabling the `alloc` feature. |
| 22 | |
| 23 | Methods referring to `CStr` and `CString` are also unavailable. |
| 24 | The `Error` trait also only exists in `std`, but `description()` is made |
| 25 | available as an inherent method for `ToAsciiCharError` and `AsAsciiStrError` |
| 26 | in `#![no_std]`-mode. |
| 27 | |
| 28 | To use the `ascii` crate in `#![no_std]` mode in your cargo project, |
| 29 | just add the following dependency declaration in `Cargo.toml`: |
| 30 | |
| 31 | ```toml |
| 32 | [dependencies] |
| 33 | ascii = { version = "1.1", default-features = false, features = ["alloc"] } |
| 34 | ``` |
| 35 | |
| 36 | ## Minimum supported Rust version |
| 37 | |
| 38 | The minimum Rust version for 1.1.\* releases is 1.41.1. |
| 39 | Later 1.y.0 releases might require newer Rust versions, but the three most |
| 40 | recent stable releases at the time of publishing will always be supported. |
| 41 | For example this means that if the current stable Rust version is 1.70 when |
| 42 | ascii 1.2.0 is released, then ascii 1.2.\* will not require a newer |
| 43 | Rust version than 1.68. |
| 44 | |
| 45 | ## History |
| 46 | |
| 47 | This package included the Ascii types that were removed from the Rust standard |
| 48 | library by the 2014-12 [reform of the `std::ascii` module](https://github.com/rust-lang/rfcs/pull/486). |
| 49 | The API changed significantly since then. |
| 50 | |
| 51 | ## License |
| 52 | |
| 53 | Licensed under either of |
| 54 | |
| 55 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) |
| 56 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |
| 57 | |
| 58 | at your option. |
| 59 | |
| 60 | ### Contribution |
| 61 | |
| 62 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 63 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any |
| 64 | additional terms or conditions. |