Skip to main content

read_file_string

Function read_file_string 

Source
pub fn read_file_string(path: &Path, max_size: u64) -> Result<String>
Expand description

Read a file as a UTF-8 string, using mmap for files above the threshold.

Files exceeding max_size are rejected before any allocation occurs.

§Errors

Returns AtomwriteError::NotFound if the file does not exist. Returns AtomwriteError::FileTooLarge if the file exceeds max_size. Returns AtomwriteError::InvalidInput if the file is not valid UTF-8. Returns an I/O error if the file cannot be read or mmapped.