Beginner
Rust
Q38 / 100
What are generics in Rust?
Correct! Well done.
Incorrect.
The correct answer is B) Type parameters (<T>) that allow writing functions, structs, and enums that work with multiple types while maintaining type safety
B
Correct Answer
Type parameters (<T>) that allow writing functions, structs, and enums that work with multiple types while maintaining type safety
Explanation
fn largest<T: PartialOrd>(list: &[T]) -> T works for any type T that implements PartialOrd. Rust monomorphizes generics at compile time.
Progress
38/100