Skip to main content

variant_index_of

Function variant_index_of 

Source
pub const fn variant_index_of<T>(variant: &T, variants: &[T]) -> usize
Expand description

Finds the index of variant in the variants slice using const-compatible equality.

This function is intended to be called inside const { } blocks in the derive macro, so its O(N) cost is paid at compile time, not runtime.