Struct hanzi4096::字读 [] [src]

pub struct 字读 { /* fields omitted */ }
use std::io::Read;
use hanzi4096::ZiRead;

let mut r = ZiRead::from(
    "桃之夭夭灼灼其华之子于归宜其室家"
);
let mut output = [0; 24];
r.read(&mut output).unwrap();
assert_eq!(
    output,
    [51, 151, 3, 125, 208, 7, 84, 67, 53, 227, 115, 29, 57, 240, 3, 23, 144, 14, 253, 52, 62, 160, 38, 131]
);

Methods

impl 字读
[src]

Ignore invalid char.

use std::io::Read;
use hanzi4096::{ self, ZiRead };

let text = "
    南有乔木 不可休息
    汉有游女 不可求思
    汉之广矣 不可泳思
    江之永矣 不可方思
";

let mut r = ZiRead::from(text);
let mut output = Vec::new();
r.with_ignore(true);
r.read_to_end(&mut output).unwrap();

assert_eq!(
    hanzi4096::encode(&output),
    text.lines()
        .flat_map(|line| line.split_whitespace())
        .collect::<String>()
);

Trait Implementations

impl Debug for 字读
[src]

Formats the value using the given formatter.

impl Clone for 字读
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> From<&'a str> for 字读
[src]

Performs the conversion.

impl From<String> for 字读
[src]

Performs the conversion.

impl Read for 字读
[src]

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a "by reference" adaptor for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

🔬 This is a nightly-only experimental API.   (io)

the semantics of a partial read/write of where errors happen is currently unclear and may change

Transforms this Read instance to an Iterator over chars. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more