Rust tips is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Rust tips @rust

In `pub fn new()` is used as a constructor. Use the `Self` alias to avoid typing the full type name three times:

impl LongComplexTypeName<Annoying> {
pub fn new() -> Self {
Self {
}
}
}

Note that `Self` (uppercase `S`) is a type name, as opposed to `self` variable shorthand used in methods.

Try it: is.gd/8gfXQX

· Web · 3 · 6