Skip to content

Commit

Permalink
finish traits2
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-ing committed Jan 21, 2025
1 parent 978c123 commit 7f947ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions exercises/traits/traits2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ trait AppendBar {
}

// TODO: Implement trait `AppendBar` for a vector of strings.
impl AppendBar for Vec<String>{
fn append_bar(self) -> Self{
let mut s=self;
s.push(String::from("Bar"));
s
}
}

#[cfg(test)]
mod tests {
Expand Down

0 comments on commit 7f947ba

Please sign in to comment.