3 ms·
Presumably close should return either success or a broken_file of some sort. I can't think of a use case for getting back a file which looks like you can write
by JonChesterfield 4y ago
Presumably close should return either success or a broken_file of some sort. I can't think of a use case for getting back a file which looks like you can write to it when close failed previously.
Write might be similar. I think you want to return a file on success and some information that you might be able to do something with on failure, where there might be a path to retrieving a working file from it.
Easier to see, allocate could return a MaybeHeap which you branch/match on, where one path is call a garbage collector and try again.
This is all kind of messy though. Retry loops or memory cleanup attempts should perhaps be on the far side of the API.
Rust throws an exception if things go too badly wrong as far as I can tell, though the docs tell me panic! isn't an exception, and also how to catch it.