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