[][src]Function natural_slice::position::encode_position

pub fn encode_position<T: Ord, Encoded: TryFrom<usize>>(
    data: &[T],
    is_interesting: &dyn Fn(&T) -> bool
) -> Result<Encoded, Encoded::Error>

Encode the position of the interesting elements in a slice as a single natural number. Note that we don't care about the relative positions of the interesting elements, which allows us to deal with a smaller number of possibilities.

In the context of a Rubiks Cube, the calculation is explained with an example here: http://kociemba.org/math/UDSliceCoord.htm