4 ms·
Yeah implementing traits for functions is rarely advisable. However in this one very specific case (what amounts to dependency injection) it gives us very nice
by _cart 6y ago
Yeah implementing traits for functions is rarely advisable. However in this one very specific case (what amounts to dependency injection) it gives us very nice clarity and ergonomics. I'll take that over the macros everyone else is using in this context, or the expensive "runtime reflection" other languages might use to do the same thing. At least its still "normal" static rust code.