Y
Hacker News
new
|
ask
|
show
|
jobs
by
belovedeagle
3332 days ago
Which already exists in Rust in the form of... wait for it... the Drop trait. It's the same thing.
1 comments
matt_kantor
3332 days ago
The difference is that Go's `defer` is explicitly written out in the relevant scope, while Rust's `Drop` is implicit and defined elsewhere.
link
steveklabnik
3332 days ago
There's a "scopeguard" crate that uses Drop to make it explicit.
link