|
|
|
|
|
by 4bpp
2612 days ago
|
|
How does Rust handle these problems in the context of file I/O? I'm sure there is an axiomatically idiomatic (official) implementation of it as part of the language distribution, and at the same time file handles seem conceptually very similar to display handles and should have similar failure patterns (space can run out, a disk can fail, a plug-and-play disk can be yanked out at any time...). |
|
These failure patterns are handled by each method, for example,
that Result will return an error if the file can't be opened, etc. Let's say you want to write some bytes, that's This also returns Result, so if you've opened the file, but the disk is now out of space, this will return an error, etc.