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

@@ -6,6 +6,14 @@ trait AppendBar {
impl AppendBar for String {
// TODO: Implement `AppendBar` for the type `String`.
fn append_bar(self) -> Self{
// In this i need to put mut in front of the parameter
// self.push_str("Bar");
// self
// This way is more readable
self + "Bar"
}
}
fn main() {