In actual Rust APIs, opening a file returns a result, which needs to be handled or unwrapped in order to operate on the file.
All resources in Rust are implicitly like your Python with example -- when they go out of scope and destructors run, the file will be closed.