In Rust pub fn new()
is used as a constructor. Use the Self
type alias to avoid typing the full type name three times:
Note that Self
(uppercase S
) is a type name, as opposed to self
variable shorthand used in methods.
Try it: Rust Playground