Loading tutorials
fn largest<T>. Here you apply type parameters to data types.2 min read<T>, implement a trait for a type, and borrow with &T.2 min readT: Display, and read a trait path like std::fmt::Debug. It builds on the trait bounds chapter. It adds no new capabilities for ordinary bounds. It changes where you write them, and it allows a few bounds tha2 min readPoint<T>, write a trait bound, and read an impl block. It covers how impl blocks interact with type parameters, and how that lets you give some instantiations of a type extra methods.2 min readwhere clauses, and closures at a basic level. impl Trait is shorthand that lets you name a capability instead of a concrete type. It works in two positions, and it means something different in each.2 min readBox and Vec. Rust gives you two ways to write code against a trait: generics (T: Trait) and trait objects (dyn Trait). Both accept many types. They differ in when the compiler picks2 min read&T. It shows how lifetime parameters and type parameters share one declaration list, and where they interact.2 min readtype item inside a trait, when to prefer it over a second type parameter, and the errors you will most likely meet.2 min readT: Debug. A blanket implementation uses those pieces together.2 min read[i32; 3].2 min readimpl<T> blocks, and that you know what zero-sized types are. It shows how to give a type a parameter that exists only for the compiler.2 min read