utf8_iter

Crates.ioutf8_iter
lib.rsutf8_iter
version1.0.4
sourcesrc
created_at2022-04-19 08:36:06.371431
updated_at2023-12-01 17:26:51.542538
descriptionIterator by char over potentially-invalid UTF-8 in &[u8]
homepagehttps://docs.rs/utf8_iter/
repositoryhttps://github.com/hsivonen/utf8_iter
max_upload_size
id570230
size40,417
ulms (github:foxford:ulms)

documentation

https://docs.rs/utf8_iter/

README

utf8_iter

crates.io docs.rs

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.

Licensing

TL;DR: Apache-2.0 OR MIT

Please see the file named COPYRIGHT.

Documentation

Generated API documentation is available online.

Release Notes

1.0.4

  • Add iteration by Result<char,Utf8CharsError>.

1.0.3

  • Fix an error in documentation.

1.0.2

  • char_indices() implementation.

1.0.1

  • as_slice() method.
  • Implement DoubleEndedIterator

1.0.0

The initial release.

Commit count: 11

cargo fmt