Skip to main content

TextIn

Trait TextIn 

Source
pub trait TextIn {
    type Error;

    // Required method
    fn read_text<'a>(
        &mut self,
        buf: &'a mut [u8],
    ) -> Result<&'a str, Self::Error> โ“˜;
}
Expand description

๐Ÿ”Œ ๐“ Reads UTF-8 text from an input surface into caller-provided storage.


๐Ÿ“ sys/io


This is the text-layer counterpart to IoRead. It is intended for sources whose primary semantic payload is text, while keeping storage explicit and allocation optional.

See also IoRead for byte-oriented input.

Required Associated Typesยง

Source

type Error

The error returned when text input fails.

Required Methodsยง

Source

fn read_text<'a>(&mut self, buf: &'a mut [u8]) -> Result<&'a str, Self::Error> โ“˜

Reads some UTF-8 text into buf, returning the written subslice.

Dyn Compatibilityยง

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementorsยง