this post was submitted on 28 Dec 2023
110 points (96.6% liked)

Rust

5651 readers
11 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
 

Traits now support async fn and -> impl Trait (with some limitations), the compiler got faster, version = in Cargo​.toml is now optional, and many small functions have been stabilized!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 7 months ago* (last edited 7 months ago) (1 children)

You could argue that C++'s new is Rust's Box::new, and delete is replaced by RAII. Same concepts but way better ergonomy.

[–] [email protected] 1 points 7 months ago

box::new is pretty directly analogous to std::make_unique (factory for unique_ptr), in general rust’s heap allocating types map to c++’s smart pointer types, which are basically universally recommended over raw new/delete. So another column where rust just gives you the one best C++ feature where it still has 4 supported versions.