Add note about monomorphisation
Author: marcospb19Created Apr 17, 2021Updated Dec 30, 2023
Labelsenhancement
Generics with static dispatch can lead to duplicated functions, and if they are big enough, it will make for a large piece of the final binary.
Alternatives are dynamic dispatch with dyn, or just removing generic code.
Is seems very important for minimizing binary size.
(If you don't want to change the function API, and the function is being generic over something like AsRef<Path>, you can also create helper function which resolves path.as_ref() and calls a non-generic function that receives &Path instead.)
Source: johnthagen/min-sized-rust