Multiple Bounds
We'll cover the following...
We'll cover the following...
I want to write a function, info, that prints out some information about a number. It’s easier if I just show it to you:
Since our info is defined in terms of the double method only, though, it seems like we should be able to parameterize. Try changing the signature from i32 to a type parameter:
This generates an error message:
error[E0277]: `T` doesn't implement `std::fmt::Display`
--> src/main.rs:10:37
|
9 | fn info<T: Double>(x: T) {
| -- help: consider ...