Skip to content

Glossary: Algorithms Beyond the Basics in Rust

Sentinel value (u32::MAX, saturating_add)

Also written: u32::MAX, MAX, saturating_add

`u32::MAX`, the largest `u32` (4,294,967,295), stands in for "not possible yet" or "no route found yet" because it loses every `<` comparison. Adding 1 to it would overflow, so `saturating_add(1)` stops at the maximum instead.

Where the book teaches it

Related terms

Dijkstra's algorithmDebug build