//@ What this does is define an entire family of types: We can now write
//@ `SomethingOrNothing<i32>` to get back our `NumberOrNothing`.
type NumberOrNothing = SomethingOrNothing<i32>;
-
//@ However, we can also write `SomethingOrNothing<bool>` or even
//@ `SomethingOrNothing<SomethingOrNothing<i32>>`. In fact, a type like `SomethingOrNothing` is so
//@ useful that it is already present in the standard library: It's called an *option type*,
//@ Next, we write `vec_min` as a generic function over a type `T` that we demand to satisfy the `Minimum` trait.
//@ This requirement is called a *trait bound*.
//@ The only difference to the version from the previous part is that we call `e.min(n)` instead
-//@ of `std::cmp::min(n, e)`. Rust automatically figures out that `n` is of type `T`, which implements
+//@ of `min_i32(n, e)`. Rust automatically figures out that `e` is of type `T`, which implements
//@ the `Minimum` trait, and hence we can call that function.
//@
//@ There is a crucial difference to templates in C++: We actually have to declare which traits
}
// We again provide a `print` function.
-
-
//@ This also shows that we can have multiple `impl` blocks for the same type (remember that
//@ `NumberOrNothing` is just a type alias for `SomethingOrNothing<i32>`), and we can provide some
//@ methods only for certain instances of a generic type.