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]
fn with_ignore(&mut self, flag: bool) -> &mut Self
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]
impl Clone for 字读
[src]
fn clone(&self) -> 字读
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> From<&'a str> for 字读
[src]
impl From<String> for 字读
[src]
impl Read for 字读
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0
Read the exact number of bytes required to fill buf
. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Read
. Read more
fn bytes(self) -> Bytes<Self>
1.0.0
Transforms this Read
instance to an Iterator
over its bytes. Read more
fn chars(self) -> Chars<Self>
🔬 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 char
s. Read more
fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read
1.0.0
Creates an adaptor which will chain this stream with another. Read more
fn take(self, limit: u64) -> Take<Self>
1.0.0
Creates an adaptor which will read at most limit
bytes from it. Read more