Use the `where` keyword after a function signature to list trait constraints for generic types cleanly.
Use a where clause to specify trait bounds for generic types when the signature becomes too long or complex. Place the where keyword after the function's return type (or after the generic parameters in structs/impls) and list each constraint on a new line ending with a comma.
fn some_function<T, U>(t: &T, u: &U) -> i32
where
T: Display + Clone,
U: Clone + Debug,
{
unimplemented!()
}
A where clause is a way to list rules for your generic types without cluttering the function name. Think of it like a job description attached to a role; instead of listing every requirement in the title, you put them in a separate section below. You use this when you have multiple types or complex requirements that make the code hard to read.