#encoding #utf-8 #unicode #iterator

utf8_iter

Iterator by char over potentially-invalid UTF-8 in &[u8]

4 stable releases

1.0.3 Sep 9, 2022
1.0.1 Jul 19, 2022
1.0.0 Apr 19, 2022

#115 in Text processing

Download history 2793/week @ 2022-12-03 3690/week @ 2022-12-10 4631/week @ 2022-12-17 3590/week @ 2022-12-24 4947/week @ 2022-12-31 4946/week @ 2023-01-07 4478/week @ 2023-01-14 3870/week @ 2023-01-21 4599/week @ 2023-01-28 4647/week @ 2023-02-04 3977/week @ 2023-02-11 4472/week @ 2023-02-18 3652/week @ 2023-02-25 4287/week @ 2023-03-04 5168/week @ 2023-03-11 5278/week @ 2023-03-18

19,212 downloads per month
Used in 15 crates (4 directly)

Apache-2.0 OR MIT

17KB
263 lines

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.

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.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.

No runtime deps