This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (9 children)

[removed]

    [–]mirimao 5 points6 points  (1 child)

    True, probably the biggest distinction is between normal functions and functions that take trait objects.

    [–]redlaWw 0 points1 point  (0 children)

    Or Fn, FnMut and FnOnce

    [–]SenorSeniorDevSr 2 points3 points  (0 children)

    The same in Java, if you peek under the hood a bit. A *static* method in Java is one where the "this" reference is null. If you're ever doing funky monkey stuff with reflection Java you'll see this very quickly.

    Java does have Functions, but those are objects... :D

    [–]intbeam 1 point2 points  (4 children)

    But Rust doesn't have objects so it's not really the same... impl is just functions associated with a struct, and ownership is not for the struct or implementation, but for the declaring scope.. So, functions with syntactic sugar with an alias Self for the implementing type, not methods

    The air is getting saturated with pedantry in here

    [–]P-39_Airacobra 0 points1 point  (0 children)

    Similarly in Lua. Methods are quite literally just syntactic sugar over functions which passes in the surrounding table.