this post was submitted on 16 Aug 2023
37 points (97.4% liked)

Rust

5960 readers
2 users here now

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

Wormhole

!performance@programming.dev

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
top 3 comments
sorted by: hot top controversial new old
[โ€“] spez@sh.itjust.works 5 points 1 year ago (1 children)

Toot :

๐Ÿฆ€ In #rustlang 1.73.0 (to be released on October 5th), it'll be easier to use thread_local Cells and RefCells: the set, get, replace, take, and with_borrow[_mut] methods will be directly available on the thread local, removing the need for the usual .with(|_| โ€ฆ) pattern: 1/2

The new .set() method can be more efficient than .with(|x| x.set()), because it skips the step where the first call to with initializes the variable. The option to skip the default initializer can be very useful in some situations:

2/2

[โ€“] darcy@sh.itjust.works 4 points 1 year ago (1 children)
[โ€“] Barbacamanitu@lemmy.world 2 points 1 year ago

Lol not a great name choice. Wish I would have thought of it though.