Completed exercise up to Traits
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user