talent-plan
talent-plan copied to clipboard
the trait `kvs::KvsEngine` cannot be made into an object
Hey guys, I've been chugging through this course, and I've noticed something in the instructions which I believe is completely impossible.
In Project 4, you suggest to change the definition of KvsEngine to pub trait KvsEngine: Clone + Send + 'static
.
Are you aware that this makes KvsEngine not object-safe? See: https://www.reddit.com/r/rust/comments/7q3bz8/trait_object_with_clone/ for some good explanations.
I got very stuck here for a while, because it means I can't create Box<dyn KvsEngine>
types, which was how I was writing my logic. Basically I can't do polymophism anymore if I make KvsEngine implement Clone
.