Kind of with Rust had a notion of `impl TryDrop` for running destructors that can be unsuccessful. Could handle errors gracefully in Result contexts. Call `.unwrap()` in other contexts. Manually dropping through `try_drop(my_fn())?;`
Ah yes, yeah I think we're mostly on the same page. Def would be a convenience method!
-
-
note that the convenience trait doesn't really get you much what you're looking for is basically this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=998124658c390fcdeff749a26c4c4618 …
-
Hmm, what if you have two instances of Foo, and the cleanup method errors halfway through? Drop would still be called right. But all other instances of .cleanup() would not. Might potentially leak?
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.