News Score: Score the News, Sort the News, Rewrite the Headlines

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 mistakes please let me know and I will try to correct them. With that out of the way, lets get started. My real motivation for taking a closer look at dynamic dispatch can be seen in the following code snippet. Suppose I want to create a struct CloningLab that contains a vector of trait objects (in this case, Mammal): struct CloningLab { subjects: Vec<Box<Mammal>>, } t...

Read more at alschwalm.com

© News Score  score the news, sort the news, rewrite the headlines