From: Ralf Jung Date: Sat, 25 Mar 2023 21:38:31 +0000 (+0100) Subject: clarify exercise X-Git-Url: https://git.ralfj.de/rust-101.git/commitdiff_plain/4cac8138d63e49c60d101bee79b9e60644b3de0a?hp=5c86632a09410065f7ed67d8c965999edd4172a3 clarify exercise --- diff --git a/src/part03.rs b/src/part03.rs index 2085d34..b81bbc3 100644 --- a/src/part03.rs +++ b/src/part03.rs @@ -99,10 +99,10 @@ pub fn main() { min.print(); /*@*/ } -// **Exercise 03.1**: Define a trait `Print` to write a generic version of -// `SomethingOrNothing::print`. -// Implement that trait for `i32`, make `print2 use it, and change `main` above to use the new -// generic `print2` function. +// **Exercise 03.1**: The goal is to write a generic version of `SomethingOrNothing::print`. +// To this end, define a trait `Print` that provides (simple) generic printing, and implement +// that trait for `i32`. Then define `SomethingOrNothing::print2` to use that trait, and change +// `main` above to use the new generic `print2` function. // I will again provide a skeleton for this solution. It also shows how to attach bounds to generic // implementations (just compare it to the `impl` block from the previous exercise). // You can read this as "For all types `T` satisfying the `Print` trait, I provide an implementation