File: infallible.rs

package info (click to toggle)
rust-utf8-decode 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 148 kB
  • sloc: makefile: 2
file content (18 lines) | stat: -rw-r--r-- 380 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use utf8_decode::{Decoder, Utf8Error};

fn main() -> Result<(), Utf8Error> {
    let bytes = [
        72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 32, 240, 159, 140, 141,
    ];

    let decoder = Decoder::new(bytes.iter().cloned());

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

    println!("{}", string);

    Ok(())
}