Hello fellow Rustaceans. I have a rather simple question on how the use imports are working.
I noticed that I cannot use file.read_to_string()
unless I use std::io::read
where file is returned from File::open()
.
So basically, I would expect that read_to_string() is part of File but it is actually part of io, but it is called from a File object.
My only area of confusion is how a function from one mod can be used on an object from another mod and/or how I could tell in the future because this page has it under std::fs but I was getting compiler errors saying it could not be found until I finally tried std::io. Thanks.