Feel somewhat confused that `io::Read::read_to_string` writes into a referenced string, while `fs::read_to_string` allocates a new string. Could imagine the justification for it is method vs function, but it's... somewhat nuanced?
Not sure I follow? I'm referring to the relationship between the function and String. E.g. read_to_string(s: &mut String) -> Result<()> vs read_to_string() -> Result<String> One uses a reference, the other allocates.
-
-
Yes I'm saying that fs::read_to_string just wraps the &mut call for Read. What I'm trying to say is I think the names as is are fine despite having differing fn signatures given one is a trait describing a behavior and one is an fn doing the action of reading a file into a String
-
I feel like maybe one of them might have been better named `read_into_string` but I couldn't tell you which.
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
