Type Associated functions
= Associated functions, without self
as parameter
Example
//constructors:
impl Person {
// new isn't a keyword, but best practice
pub fn new() -> Person {
name: "John"
}
}
let p = Person::new()
๐ Links
Search
Dec 18, 2024, 1 min read
= Associated functions, without self
as parameter
//constructors:
impl Person {
// new isn't a keyword, but best practice
pub fn new() -> Person {
name: "John"
}
}
let p = Person::new()
๐ Links