
Any and Downcasting in Rust Trait Objects Explained
std::any::Any lets you ask a trait object what concrete type it holds. Learn downcast_ref, Box<dyn Any>, the as_any pattern for your own traits, and when an enum is the better design.
Everything you need to level up your coding skills.

std::any::Any lets you ask a trait object what concrete type it holds. Learn downcast_ref, Box<dyn Any>, the as_any pattern for your own traits, and when an enum is the better design.

E0369 means an operator like + or == was used on a type that does not implement the matching trait. Fix it with a derive, a trait bound on the generic, or an explicit impl.

Twelve Rust interview questions with answers that explain the why: ownership, borrowing, lifetimes, traits, Send and Sync, async, unsafe. Includes what a strong answer sounds like.

Ten small projects, each chosen to force one concept: ownership, traits, error handling, lifetimes, async, unsafe. Every entry names the idea, the scope and a stopping point.

Python wins on iteration speed and libraries; Rust wins on speed, memory and shipping one binary. See where each fits, and how PyO3 lets a Python project move just its hot loop to Rust.

Both give you control without a garbage collector. Rust makes memory safety the default; C++ has the larger ecosystem and decades of code. Compare safety, tooling, interop and when to stay in C++.

Go optimizes for a team shipping a service quickly; Rust optimizes for control and correctness. Compare error handling, concurrency, memory, hiring and where each language stops being the easy answer.

Box owns one heap value, Rc shares it on one thread and Arc shares it across threads. See what each costs, when you need RefCell or Mutex too, and how to choose.

A tuple struct with one field costs nothing at runtime and stops you passing a user id where an order id belongs. Learn construction, derives, Deref pitfalls and the orphan rule workaround.

Shadowing re-binds a name with let, even to a new type, while mut changes a value in place. See when each is the right tool and the one trap that surprises people.

Logs leak more secrets than breaches: derived Debug, request headers, URLs, SQL parameters and error chains. Use secrecy, custom Debug, tracing skip and filters to stop it.

Swap iter for par_iter and Rayon splits the work across a thread pool. See the speedup conditions, the traits it needs and when it makes things slower.
We send one email when a new post is published. No spam.