2020-02-25 04:48:50 -05:00
|
|
|
trait AppendBar {
|
|
|
|
fn append_bar(self) -> Self;
|
|
|
|
}
|
|
|
|
|
2024-06-27 05:58:44 -04:00
|
|
|
// TODO: Implement the trait `AppendBar` for a vector of strings.
|
|
|
|
// `appned_bar` should push the string "Bar" into the vector.
|
2020-02-25 04:48:50 -05:00
|
|
|
|
2024-04-17 16:46:21 -04:00
|
|
|
fn main() {
|
|
|
|
// You can optionally experiment here.
|
|
|
|
}
|
|
|
|
|
2020-02-25 04:48:50 -05:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn is_vec_pop_eq_bar() {
|
|
|
|
let mut foo = vec![String::from("Foo")].append_bar();
|
2024-06-27 05:58:44 -04:00
|
|
|
assert_eq!(foo.pop().unwrap(), "Bar");
|
|
|
|
assert_eq!(foo.pop().unwrap(), "Foo");
|
2020-02-25 04:48:50 -05:00
|
|
|
}
|
2020-02-25 06:00:09 -05:00
|
|
|
}
|