New progress

This commit is contained in:
2023-05-22 05:13:08 -05:00
parent 5004cc3bbb
commit 5f8d837c7d
11 changed files with 28 additions and 24 deletions
+3 -1
View File
@@ -9,7 +9,6 @@
// implementing this trait.
// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
trait AppendBar {
fn append_bar(self) -> Self;
@@ -17,6 +16,9 @@ trait AppendBar {
impl AppendBar for String {
// TODO: Implement `AppendBar` for type `String`.
fn append_bar(self) -> Self {
format!("{}Bar", self)
}
}
fn main() {
+6 -1
View File
@@ -11,13 +11,18 @@
// you can do this!
// Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
trait AppendBar {
fn append_bar(self) -> Self;
}
// TODO: Implement trait `AppendBar` for a vector of strings.
impl AppendBar for Vec<String> {
fn append_bar(mut self) -> Self {
self.push(String::from("Bar"));
self
}
}
#[cfg(test)]
mod tests {