lazy-char-iter

Crates.iolazy-char-iter
lib.rslazy-char-iter
version0.1.0
sourcesrc
created_at2023-02-01 23:32:50.001793
updated_at2023-02-01 23:32:50.001793
descriptionLazily iterate over Unicode characters from a u8 slice in Rust.
homepagehttps://github.com/dacut/lazy-char-iter
repositoryhttps://github.com/dacut/lazy-char-iter
max_upload_size
id774366
size50,137
David Cuthbert (dacut)

documentation

README

lazy-char-iter

Lazily iterate over Unicode characters from a u8 slice in Rust.

This crate provides a .chars() method for Vec<u8> and &[u8] types, allowing you to iterate over the characters in a byte vector or slice without decoding each character preemptively.

In typical usage, you use the LazyCharIterExt trait (implemented for Vec<u8> and &[u8]) and call the .chars() method on those types:

use lazy_char_iter::LazyCharIterExt;
let bread_str: &str = "brød";
let bread_bytes: &[u8] = bread_str.as_bytes();
let mut char_iter = bread_bytes.chars();
assert_eq!(char_iter.next(), Some(Ok('b')));
Commit count: 7

cargo fmt