diff --git a/exercises/15_traits/traits4.rs b/exercises/15_traits/traits4.rs index 4bda3e57..d9a3428b 100644 --- a/exercises/15_traits/traits4.rs +++ b/exercises/15_traits/traits4.rs @@ -23,7 +23,23 @@ impl Licensed for SomeSoftware {} impl Licensed for OtherSoftware {} // YOU MAY ONLY CHANGE THE NEXT LINE -fn compare_license_types(software: ??, software_two: ??) -> bool { + +// 1. straight foreword +// fn compare_license_types(software: impl Licensed, software_two: impl Licensed) -> bool { +// software.licensing_info() == software_two.licensing_info() +// } + +// 2. trait bound +// fn compare_license_types(software: T, software_two: P) -> bool { +// software.licensing_info() == software_two.licensing_info() +// } + + +// 3. trait bound + where clause +fn compare_license_types(software: T, software_two: P) -> bool + where T: Licensed, + P: Licensed +{ software.licensing_info() == software_two.licensing_info() }