method
A function attached to a type, called with dot syntax.
A method is a function in an impl block whose first parameter is self, &self, or &mut self.
Examples
impl Book { fn is_long(&self) -> bool { self.pages > 300 } }lets you writebook.is_long().
See also