My function is as follows:
fn read_file () -> String {
let mut file = File::open("./assets/postdata/lorem_ipsum.md").unwrap();
let mut buffer = Vec::new();
let read_variable = file.read_to_end(&mut buffer).unwrap();
let filestr = String::from_utf8(buffer).unwrap();
return filestr;
}
The file is a markdown file with four paragraphs of lorem ipsum text. This function, when called by a handlebars record generator, prints to a webpage producing a wall of text. I'm obviously missing something, how can I make the Rust compiler recognise the whitespace. Can anyone help?
Aucun commentaire:
Enregistrer un commentaire