to_text

Function to_text 

Source
pub fn to_text(file: &mut File, byte_limit: Option<usize>) -> Result<String>
Expand description

Extracts text from a file up to an optional byte limit.

Reads up to byte_limit bytes from file. If the extracted bytes form valid UTF-8 text, the string is returned directly. If the buffer is truncated at a valid UTF-8 boundary before the byte limit, only the valid prefix is used. Otherwise, the bytes are passed to wfscan for scanning and tokenizing.