pub fn index_of(modes: &[DisplayMode], choice: DisplayMode) -> usizeExpand description
The list index for a (possibly persisted) choice. An exact match wins; a choice whose resolution is listed but whose rate is not (the display changed) snaps to that resolution’s nearest rate; otherwise the nearest resolution by pixel count, so a stale persisted mode still lands somewhere sensible. Returns 0 for an empty list (callers guard, but stay total).