Add exercise traits6 practicing extension traits

This commit is contained in:
Remo Senekowitsch
2026-08-30 09:00:55 +02:00
parent a650509c78
commit 0916732b5a
5 changed files with 99 additions and 0 deletions
+10
View File
@@ -793,6 +793,16 @@ replacing `???` with 'impl [what goes here?] + [what goes here?]'.
Related section in The Book:
https://doc.rust-lang.org/book/ch10-02-traits.html#specifying-multiple-trait-bounds-with-the--syntax"""
[[exercises]]
name = "traits6"
dir = "15_traits"
hint = """
Remember that you can implement a trait you defined yourself on foreign types,
i.e. ones from the standard library or third-party libraries. A trait that only
serves the purpose of adding additional functionality to foreign types is often
referred to as an "extension trait". Define such a trait and implement it for
`usize` and `&str`."""
# QUIZ 3
[[exercises]]