Get the latest tech news
Exploring Dynamic Dispatch in Rust
Let me preface this by saying that I am a novice in the world of rust (though I'm liking things so far!), so if I make technical...
According to that documentation, the memory layout of a Mammal trait object made from a Cat will consist of two pointers arranged like: It incurs a cost when 'constructing' a trait object, unlike the C++ approach in which a cast to a base pointer is free (or just some addition for multiple inheritance). Because rust does not (yet) support struct inheritance, the problem of determining the correct subobject to pass as self, does not exist.
Or read this on Hacker News