arc and moo cow

This commit is contained in:
Dylan Smith
2024-04-19 15:13:03 -04:00
parent ad26c3a4d2
commit 5484d34a98
2 changed files with 8 additions and 6 deletions

View File

@@ -12,8 +12,6 @@
//
// Execute `rustlings hint cow1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
use std::borrow::Cow;
fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> {
@@ -49,6 +47,8 @@ mod tests {
let mut input = Cow::from(&slice[..]);
match abs_all(&mut input) {
// TODO
Cow::Borrowed(_) => Ok(()),
_ => Err("Expected a reference I suppose?"),
}
}
@@ -61,6 +61,8 @@ mod tests {
let mut input = Cow::from(slice);
match abs_all(&mut input) {
// TODO
Cow::Owned(_) => Ok(()),
_ => Err("Expected owned value"),
}
}
@@ -73,6 +75,8 @@ mod tests {
let mut input = Cow::from(slice);
match abs_all(&mut input) {
// TODO
Cow::Owned(_) => Ok(()),
_ => Err("Expected owned value"),
}
}
}