Tour di Rust Indice dei Contenuti

[Non tradotto] Dynamic vs Static Dispatch

Methods are executed in two ways:

Trait types &dyn MyTrait give us the ability to work with instances of objects indirectly using dynamic dispatch.

When dynamic dispatch is used, Rust will encourage you to put dyn before your trait type so people are aware.

Memory details: