this post was submitted on 19 Mar 2026
17 points (90.5% liked)
Rust
7868 readers
51 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I just scrolled through it, so no deep insights, but at first glance it looks pretty good.
One thing I saw, and that probably every rust programmer has to learn in the beginning, is to use slices for function parameters whenever prossible. Pretty much every time you use
fn foo(s: &String)you should usefn foo(s: &str)and the same goes for&Vec<T>->&[T]. Calling these works still the same so just changing the function definitions should work.The advantage of this is, that now you can use every type that can be dereferenced as the slice, so you can now call foo like this
foo("bar");or with aStringfoo(&String::from("bar"));. The same applies for&[T]which can be called with&Vec<T>or an array&[T; N]