AKA: Why is consuming an Iterator
from glutin so damn hard?
In Rust, like many other languages, there are two different ways to call a function: static and dynamic dispatch. They're used in different scenarios and each have their own pros and cons, which are summarised thusly:
- Static calls tend to be faster because they do not require the use of a lookup table, which incurs overhead as the compiler has to 'find' the function it is calling at runtime.
- Dynamic calls tend to be more conservative of space as they can be re-used. This isn't so much an issue with functions like
strcpy
, but with functions that have multiple types of arguments (generics, for example), the code for the function must be duplicated.