Crates.io | utf8_iter |
lib.rs | utf8_iter |
version | 1.0.4 |
source | src |
created_at | 2022-04-19 08:36:06.371431 |
updated_at | 2023-12-01 17:26:51.542538 |
description | Iterator by char over potentially-invalid UTF-8 in &[u8] |
homepage | https://docs.rs/utf8_iter/ |
repository | https://github.com/hsivonen/utf8_iter |
max_upload_size | |
id | 570230 |
size | 40,417 |
utf8_iter provides iteration by char
over potentially-invalid UTF-8 &[u8]
such that UTF-8 errors are handled according to the WHATWG Encoding Standard.
Iteration by Result<char,Utf8CharsError>
is provided as an alternative that
distinguishes UTF-8 errors from U+FFFD appearing in the input.
An implementation of char_indices()
analogous to the same-name method on
str
is also provided.
Key parts of the code are copypaste from the UTF-8 to UTF-16 conversion code
in encoding_rs
, which was optimized for speed in the case of valid input.
The implementation here uses the structure that was found to be fast in the
encoding_rs
context but the structure hasn't been benchmarked in this
context.
This is a no_std
crate.
TL;DR: Apache-2.0 OR MIT
Please see the file named COPYRIGHT.
Generated API documentation is available online.
Result<char,Utf8CharsError>
.char_indices()
implementation.as_slice()
method.DoubleEndedIterator
The initial release.