What is the best practice of polymorphism in rust

⚓ Rust    📅 2025-10-04    👤 surdeus    👁️ 6      

surdeus

Since Rust is not an OOP language, I often need Box to act the polymorphism behavior.

I've see this video on YouTube, but I don't consider it is the best practice because I need to write tons of match statements to invoke the methods.

Does the Box way is the best practice?

But in large codebases, too many Box::new will cause the code hard to read.

3 posts - 2 participants

Read full topic

🏷️ Rust_feed