Trait utf8_io::ReadStr[][src]

pub trait ReadStr: Read {
    fn read_str(&mut self, buf: &mut str) -> Result<usize>;

    fn read_exact_str(&mut self, buf: &mut str) -> Result<()> { ... }
Expand description

Extend the Read trait with read_str, a method for reading UTF-8 data.

Required methods

Like read but produces the result in a str. Be sure to check the size field of the return value to see how many bytes were written.

buf must be at least 4 bytes long, so that any valid UTF-8 codepoint can be read.

Provided methods

Like read_exact but produces the result in a str.