3 ms·
Concrete example for those not familiar with Rust: In most languages, you have a lock on the side that you need to remember to take to protect some data. In Ru
by yencabulator 2y ago
Concrete example for those not familiar with Rust:
In most languages, you have a lock on the side that you need to remember to take to protect some data. In Rust, the lock wraps the guarded data, you can't access the data without holding the lock, you can't forget to unlock, and you can't keep a reference alive while releasing the lock.
https://doc.rust-lang.org/std/sync/struct.Mutex.html https://doc.rust-lang.org/std/sync/struct.Mutex.html
https://doc.rust-lang.org/std/sync/struct.MutexGuard.html https://doc.rust-lang.org/std/sync/struct.MutexGuard.html