pub fn read_to_string<P: AsRef<Path>>(path: P) -> Result<String>
Expand description
Reads the entire contents of a file into a string.
This is a convenience function for using File::open
, Read::read_to_end
, and String::from_utf8
(no_std_io does not support read_to_string).
§Errors
This function will error if the path doesn’t exist, if the file is not valid UTF-8,
or any other error according to OpenOptions::open
.