lundi 4 avril 2016

How Rust implement reflection

Rust has Any trait. But Rust also have "do not pay for what do you not use" policy. How do Rust implement it? I guess that rust is using lazy tagging. Every type is initially unassigned, but later if the instance of type is passed to function expecting Any trait, the type is assigned a TypeId. Or is Rust just put Type I'd on every type that its instance is possibly passed to that function. I guess the former would be expensive.





Aucun commentaire:

Enregistrer un commentaire