You can see that the number in the 0 index is always largest: 25, 20, 15, 10, 5, then 0. But the other ones are all different.
A good way to use a `BinaryHeap` is for a collection of things to do. Here we create a `BinaryHeap<u8, &str>` where the `u8` is a number for the importance of the task. The `&str` is a description of what to do.
A good way to use a `BinaryHeap` is for a collection of things to do. Here we create a `BinaryHeap<(u8, &str)>` where the `u8` is a number for the importance of the task. The `&str` is a description of what to do.
```rust
use std::collections::BinaryHeap;
@ -4421,7 +4421,7 @@ You must: phone Loki back
There is an even shorter way to deal with `Result` (and `Option`), shorter than `match` and even shorter than `if let`. It is called the "question mark operator", and is just `?`. After a function that returns a result, you can add `?`. This will:
- return what it inside the `Result` if it is `Ok`
- return what is inside the `Result` if it is `Ok`
- pass the error back if it is `Err`
In other words, it does almost everything for you.
@ -5161,7 +5161,7 @@ trait FightClose: std::fmt::Debug { // Now a type needs Debug to use FightClose
impl FightClose for Wizard {}
impl FightClose for Ranger {}
trait FightFromDistance: std::fmt::Debug { // We could also do trait FightFromdistance: FightClose because FightClose needs Debug
trait FightFromDistance: std::fmt::Debug { // We could also do trait FightFromDistance: FightClose because FightClose needs Debug