dimanche 8 juillet 2018

Why is `impl Distribution

I am modifying some code to depend on rand-0.5 and at first worried how i would enable generating random values of my own types with Standard, but found out this is legal:

impl ::rand::distributions::Distribution<MyType> for ::rand::distributions::Standard {
    ...
}

Why is it legal? I thought implementing an external trait for an external type is illegal.




Aucun commentaire:

Enregistrer un commentaire