pub fn read_to_string<P: AsRef<Path>>(
path: P,
restriction: usize,
) -> Result<String>Expand description
Read the entire contents of a file into a string, provided it fits within a specified size limit.
This is a restricted alternative to std::fs::read_to_string
with otherwise identical semantics.
ยงExamples
fn main() -> std::io::Result<()> {
let string_at_most_64_bytes = read_restrict::read_to_string("foo.txt", 64)?;
Ok(())
}