Reputation: 30202
The following code works and I don't know why:
File::open(&some_path).read_to_end().unwrap();
Looking at the API docs I can see File::open()
returning a IoResult
which does not have a read_to_end()
.
Is there some kind of syntax sugar going on? Does Result<T, Error>
somehow turn into Result<U, Error>
?
Documentation: http://doc.rust-lang.org/std/io/fs/struct.File.html#method.read_to_end
Upvotes: 7
Views: 564