EN | DE

Stage 8.13: Generic Functions Shorthand

Rust has a shorthand for expressing generics constrained by a trait:

fn my_function(foo: impl Foo) {
    ...
}

This is equivalent to writing:

fn my_function<T>(foo: T)
where
    T: Foo
{
    ...
}