utf8-decode 2.0.0

UTF-8 incremental decoding iterators.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::{fs::File, io::Read};
use utf8_decode::TryDecoder;

fn main() -> std::io::Result<()> {
    let file = File::open("examples/file.txt")?;

    let decoder = TryDecoder::new(file.bytes());

    let mut string = String::new();
    for c in decoder {
        string.push(c?);
    }

    println!("{}", string);

    Ok(())
}