The implementation is actually generic over the return type. full — Data structures for representing the syntax tree of all valid Rust source code, including items and expressions. A phantom type parameter is simply a type parameter which is never used. As Rust by Example puts it: A trait is a collection of methods defined for an unknown type: Self. Yes. The caller needs to know that the input struct implements Default. There's no guarantee that T is a bool. Rust - Functions. However, if a type implements the Copy trait, ... in Deref, the type parameter T is an output type parameter, in the sense that the concrete type implementing Deref determines a unique concrete type for T. Rust provides associated types to denote output type parameters: A problem can be defined by implementing the ArgminOp trait which comes with the associated types Param, Output and Hessian. This ensures that the code behaves as expected. So when you implement it for some type Foo, you don’t need to write impl Add
for Foo.Similarly, when you use it as a generic type constraint T: Add