function that depends on the Number parameter, that must implement the HasSquareRoot trait
(x: Number)
| 16 | // function that depends on the Number parameter, |
| 17 | // that must implement the HasSquareRoot trait |
| 18 | fn quartic_root<Number>(x: Number) -> Number |
| 19 | where Number: HasSquareRoot { |
| 20 | x.sq_root().sq_root() |
| 21 | } |
| 22 | // Here that function if instantiated twice, in both cases |
| 23 | // using types that implement the HasSquareRoot trait |
| 24 | print!("{} {}", |