Rust's Drop trait is super neat. It's as if you were able to trigger an event when a value is GC'd in JS. Close DB handles, close files, clean up memory, close connections. Defining cleanup code at the constructor level means there's less stuff to think about when using it.
-
-
Replying to @yoshuawuyts
I'm writing a little library that uses Deref + DerefMut + Drop to wrap mutexes/rwlocks in multithreaded code to get deterministic replay by calling out to a scheduler on lock, drop, and for rwlocks again after acquisition :) you can do some freaky stuff with these traits
1 reply 0 retweets 1 like
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.