Timeline for Dijkstra's implementation in rust
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 13, 2020 at 12:54 | comment | added | L. F. |
Yes. if let is a control flow that works the way you described - enter the block if the let binding matches.
|
|
Aug 13, 2020 at 11:58 | comment | added | Zskdan |
I'm not sure of understanding the syntax of the new code: Does let Some(index) = index is handled as condition which return False in case of index == None and True otherwise?
|
|
Aug 13, 2020 at 11:53 | comment | added | L. F. | @Zskdan That's right. I've modified the code. | |
Aug 13, 2020 at 11:53 | history | edited | L. F. | CC BY-SA 4.0 |
added 53 characters in body
|
Aug 13, 2020 at 11:38 | comment | added | Zskdan |
The new remove() code trig a compilation issue since iterator::position return an Option . So I had to adapt it to: match self.unvisited.iter().position(|vertex| vertex==v) { None => (), Some(index) => { self.unvisited.remove(index); } }
|
|
Aug 13, 2020 at 10:03 | comment | added | Zskdan | Thanks @L.F. now the code looks more rust idiomatic. | |
Aug 13, 2020 at 0:36 | history | answered | L. F. | CC BY-SA 4.0 |