I have a feeling you are brand new to this language (apologies if I’m wrong) and perhaps these answers are overcomplicating things (no disrespect to anyone trying to help here!)
The short answer is that you can choose to annotate your callback implementations (in the case of LiveView:
handle_event/3, etc) with
@impl true. Without worrying about anything else, the absolute simplest thing this accomplishes is letting anyone reading the file know that these are callbacks. While it is optional, I highly recommend it.
@tomkonidas provided a very good explanation of behaviours (which you are now well aware is what
@impl true is tied to) but my one-line definition is: “a set of functions a module must implement”. As a starting point, you can think of behaviours like interfaces from OO even though it’s not strictly true.
Also, when defining multiple versions of the same function, you only need to annotate the first one:
def handle_event("update_post", params, socket) do
# not required here!
def handle_event("delete_post", params, socket) do