untrusted:: fs:: read_to_string
pub fn read_to_string<P: AsRef<Path>>(path: P) -> Result<String>
Read the entire contents of a file into a string.
This is a convenience function for using
with fewer imports and without an intermediate variable. It pre-allocates a
buffer based on the file size when available, so it is generally faster than
reading into a string created with
This function will return an error if
path does not already exist.
Other errors may also be returned according to
It will also return an error if it encounters while reading an error
of a kind other than
or if the contents of the file are not valid UTF-8.