feat: completed solutions

This commit is contained in:
2026-03-23 03:36:33 -04:00
parent 2279bea6f1
commit f568c094cb
65 changed files with 424 additions and 139 deletions
+16 -2
View File
@@ -27,7 +27,21 @@ mod my_module {
use super::Command;
// TODO: Complete the function as described above.
// pub fn transformer(input: ???) -> ??? { ??? }
pub fn transformer(input: Vec<(String, Command)>) -> Vec<String> {
let mut output: Vec<String> = Vec::new();
for (string, command) in input {
match command {
Command::Uppercase => output.push(string.to_uppercase()),
Command::Trim => output.push(string.trim().into()),
Command::Append(number_of_times_bar_will_be_added) => {
output.push(string + &"bar".repeat(number_of_times_bar_will_be_added))
}
}
}
output
}
}
fn main() {
@@ -37,8 +51,8 @@ fn main() {
#[cfg(test)]
mod tests {
// TODO: What do we need to import to have `transformer` in scope?
// use ???;
use super::Command;
use super::my_module::transformer;
#[test]
fn it_works() {