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!
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!
Honestly the only things that are similar to C++ are small amounts of C-like syntax, RAII, smart pointers, and iterators. And even so, Rust improves those features a lot. The list of things that Rust rejects from C++ is much larger; Rust does not have:
new
anddelete
(perhaps discouraged in modern C++)Result
values)Rust does OOP very differently and leans harder into functional paradigms.
You could argue that C++'s new is Rust’s Box::new, and delete is replaced by RAII. Same concepts but way better ergonomy.
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.
The way I often describe it is “Rust makes functional programming feel as intuitive as object oriented programming”.
Pedantically, Rust does offer a subset of object oriented programming paradigms so one could argue that it counts as an object oriented language, but the design patterns that work the best with the language are all coming from functional programming, all without feeling too alien to someone coming from a strictly object oriented background (… which was my own path into Rust).
A lot of Rust concepts were also influenced by Haskell even though Rust uses different terms for them.