pub fn morton_encode_generic_checked<Coor, Key, Coors>(
coors: Coors,
) -> Option<Key>where
Coor: ToPrimitive,
Key: ValidKey<Coor>,
Coors: IntoIterator<Item = Coor>,
<Coors as IntoIterator>::IntoIter: ExactSizeIterator,
Expand description
Receives an iterator of Coor
values and encodes them all in a Option<Key>
value.
Returns a None
if the iterator is empty, or if it is too large for all the Coor
values contained within to fit inside a Key
type.
ยงExamples
assert_eq!(morton_encode_generic_checked(vec!(1u8, 1)), Some(3u16));
assert_eq!(morton_encode_generic_checked::<u16, u32, Vec<u16>>(vec!()), None);
assert_eq!(morton_encode_generic_checked::<_, u16, _>(vec!(0u8, 255, 200)), None);