Downcasting
摘要
The focus of this chapter is the concept of downcasting in Rust, a powerful yet subtle feature that lets developers recover concrete types from trait objects at runtime. The chapter begins by clarifying what downcasting means within Rust’s static type system and why it becomes useful when dealing with traits. Through practical examples, you'll see how to safely downcast a trait object using standard library tools. The discussion then covers conversions between trait objects, explaining when they are valid and how they relate to Rust’s strict type safety.