this post was submitted on 16 Sep 2024
53 points (100.0% liked)

Rust

5999 readers
21 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 18 points 2 months ago (6 children)

It's a massive win, and I would question the credibility of any systems programmer that doesn't recognize that as soon as they understand the wrapper arrangement. I would have to assume that such people are going around making egregious errors in how they're using mutexes in their C-like code, and are the reason Rust is such an important language to roll out everywhere.

The only time I've ever needed a Mutex<()> so far with Rust is when I had to interop with a C library which itself was not thread safe (unprotected use of global variables), so I needed to lock the placeholder mutex each time I called one of the C functions.

[–] [email protected] 6 points 2 months ago (2 children)

Exactly. If there's only one thing I could bring from Rust into another language, it would be Mutexes. It's so nice to guarantee safe access to data.

[–] [email protected] 6 points 2 months ago* (last edited 2 months ago) (1 children)

Rust mutexes would be nice. But I think for me that one thing for me would be its enums.

[–] [email protected] 5 points 2 months ago

But only if pattern matching were included, otherwise they would be as unpleasant as C++'s std::variant.

load more comments (3 replies)