Completed exercise up to Traits

This commit is contained in:
Samuele Iacoponi
2026-02-01 16:38:57 +01:00
parent 9ef3441dba
commit b1b81f7e07
33 changed files with 732 additions and 71 deletions

View File

@@ -4,6 +4,13 @@ trait AppendBar {
// TODO: Implement the trait `AppendBar` for a vector of strings.
// `append_bar` should push the string "Bar" into the vector.
impl AppendBar for Vec<String> {
// TODO: Implement `AppendBar` for the type `String`.
fn append_bar(mut self) -> Self{
self.push("Bar".to_string());
self
}
}
fn main() {
// You can optionally experiment here.