Closed spotlesscoder closed 1 month ago
In my research, the group of functions wrapping_* are indeed methods. A method is a function associated with a type: so associated that the first parameter is 'self'. Note that in C++, structs can also have methods.
OK - but what's the difference between a method and a function in Rust?
A method is a function which is attached to a data type (a struct
or an enum
). It appears in an impl
block for that type. So all methods are functions, but not all functions are methods!
Thanks for the clarification Today I learned :)
Things you don't learn at university when they only teach OO bullshit patterns
"method" is a term that usually refers to functions provided by a class in OOP as Rust is functional, rather use the term
function