I’m noticing more and more often that different rust crates use registration of event handlers with any set of parameters the user wants, not the library developer. I have seen this in the following crates: axum, bevy engine, teloxide.
I have a question, how exactly is this done under the hood, how does the library know what parameters the event handler needs, which can have a variable number of parameters, how are they passed to the function? I want to read something on this topic. I can’t understand how the library accepts such handler methods in arguments of other methods and no macros are used.