From the book THE RUST PROGRAMMING LANGUAGE:
In two different parts of the book, the authors call the following function in (2) different ways:
match f.read_to_string(&mut s)(p.161)
let contents = fs::read_to_string(filename)(p.237)
The author states about version 1, ". . . call the read_to_string method on the file handle in f to read the contents into s." (p. 161)
The author states about version 2, ". . . fs::read_to_string takes the filename, opens that file, and returns a Result of the file's contents."
file_to_string is referred to as a function here -->read_to_string in std::fs - Rust
I'm confused as to why read_to_string is called in two different ways, and why it is that on version 1, the output is assigned to a variable (&mut s) inside the parenthesis and in version 2, the input (filename) is inside the parenthesis.