@ -2,9 +2,9 @@
### Instructions
### Instructions
Create the function `contain` that checks a `HashMap` to see if it contains the given key.
Create a **function** `contain` that checks a `HashMap` to see if it contains a given key.
Create the function `remove` that removes a given key from the `HashMap` .
Create a **function** `remove` that removes a given key from the `HashMap` .
### Notions
### Notions
@ -23,7 +23,7 @@ pub fn remove(h: &mut HashMap<&str, i32>, s: &str) {}
Here is a program to test your function.
Here is a program to test your function.
```rust
```rust
use simple_hash::simple_hash ;
use simple_hash::* ;
use std::collections::HashMap;
use std::collections::HashMap;
fn main() {
fn main() {
@ -35,16 +35,16 @@ fn main() {
println!(
println!(
"Does the HashMap contains the name Roman? => {}",
"Does the HashMap contains the name Roman? => {}",
contain(& hash, "Roman")
contain(hash.clone() , "Roman")
);
);
println!(
println!(
"Does the HashMap contains the name Katie? => {}",
"Does the HashMap contains the name Katie? => {}",
contain(& hash, "Katie")
contain(hash.clone() , "Katie")
);
);
println!("Removing Robert {:?}", remove(& mut hash, "Robert"));
println!("Removing Robert {:?}", remove(hash.clone() , "Robert"));
println!(
println!(
"Does the HashMap contains the name Robert? => {}",
"Does the HashMap contains the name Robert? => {}",
contain(& hash, "Robert")
contain(hash.clone() , "Robert")
);
);
println!("Hash {:?}", hash);
println!("Hash {:?}", hash);
}
}