/
Depends on
- debhelper (debhelper)
- dh-cargo (dh-cargo)
- rust-ascii (librust-ascii-1-dev)
- cargo, librust-ascii-0-dev, libstd-rust-dev, rustc
README (full)
encode_unicode
UTF-8 and UTF-16 character types, iterators and related methods for char, u8 and u16.
Features
Utf8Char: Acharstored as UTF-8. Can be borrowed as astroru8slice.Utf16Char: Acharstored as UTF-16. Can be borrowed as anu16slice.- Conversion methods on
char:- to and from UTF-8 as
[u8; 4]or slice. - to and from UTF-16 as
(u16, Option<u16>)or slice.
- to and from UTF-8 as
- Iterator adapters
for converting betwenn
u8s andUtf8Chars oru16s andUtf16Chars. - Optimized slice-based decoding iterators.
- Precise errors when decoding a char from UTF-8, UTF-16 or
u32fails. - Utility methods on
u8andu16.
The minimum supported version of Rust is 1.15, older versions might work now but can break with a minor update.
Optional features
#![no_std]-mode: There are a few differences:Errordoesn't exist, butdescription()is made available as an inherent impl.Extend/FromIterator-implementations forString/Vec<u8>/Vec<u16>are missing.- There is no
io, soUtf8IteratorandUtf8CharSplitterdoesn't implementRead. This feature is enabled by settingdefault-features=falseinCargo.toml:encode_unicode = {version="0.3.4", default-features=false}.
- Integration with the ascii crate:
Convert
Utf8CharandUtf16Charto and from ascii::AsciiChar.
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.
History
The original purpose of this crate was to provide standins for the then
unstable encode_utf8() and encode_utf16().
The standins were removed in 0.3 when Rust 1.15 stabilized the encode_
methods, but the other stuff I added, such as iterators like
those `encode_utf{8,16}() returned for a while, might still be of use.
| dir | benches/ |
| dir | debian/ |
| dir | src/ |
| dir | tests/ |
| file | .cargo_vcs_info.json |
| file | .gitignore |
| file | AUTHORS.md |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE-APACHE |
| file | LICENSE-MIT |
| file | README.md |
| file | RELEASES.md |