Search across all documentation pages
13 pages in this section.
Traits as capability contracts, generics plus monomorphization versus trait objects plus dynamic dispatch, and how to choose between them when designing an API.
Learn to define and implement Rust traits, use default methods, apply trait bounds on functions, and understand impl Trait in parameters.
Learn how to use default methods in Rust traits to provide base implementations and define trait hierarchies with supertraits for DRY code.
Learn to constrain generic parameters with trait bounds in Rust. Explore where clauses, multiple bounds with +, and impl Trait syntax.
Learn how to overload operators in Rust using traits like Add and Index from std::ops, implementing them for custom types.
Learn about essential Rust standard library traits like Debug, Display, Clone, From/Into, and Deref for common programming tasks.
Learn best practices for designing Rust traits and generics, covering trait design, generic bounds, coherence rules, and ergonomic considerations for robust APIs.
A single-page roundup of every highlight bullet from the 12 pages in the Traits & Generics section, grouped by source page so you can scan all 70 takeaways without opening each article individually.