From e7c14ea67e4a39789e7c1dd3a264c61a9c14050e Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog Date: Sun, 27 Sep 2026 15:47:45 -0500 Subject: rustlings: complete 15 --- rustlings/exercises/15_traits/traits2.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rustlings/exercises/15_traits/traits2.rs') diff --git a/rustlings/exercises/15_traits/traits2.rs b/rustlings/exercises/15_traits/traits2.rs index d724dc2..5dfc36d 100644 --- a/rustlings/exercises/15_traits/traits2.rs +++ b/rustlings/exercises/15_traits/traits2.rs @@ -5,6 +5,14 @@ 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 { + fn append_bar(self) -> Self { + let mut s = self.clone(); + s.push(String::from("Bar")); + s + } +} + fn main() { // You can optionally experiment here. } -- cgit v1.2.3