fn compare_keys_rtree(aa: &[u8], bb: &[u8]) -> Ordering {
        if aa.is_empty() && bb.is_empty() {
            return Ordering::Equal;
        } else if aa.is_empty() {
            return Ordering::Less;
        } else if bb.is_empty() {
            return Ordering::Greater;
        }

        let (keypath_aa, offset_aa) = Index::get_length_prefixed_slice(aa);
        let (keypath_bb, offset_bb) = Index::get_length_prefixed_slice(bb);

        // The ordering of the keypath doesn't need to be unicode collated. The ordering
        // doesn't really matters, it only matters that it's always the same.
        let keypath_compare = keypath_aa.cmp(keypath_bb);
        if keypath_compare != Ordering::Equal {
            return keypath_compare;
        }

        // Keypaths are the same, compare the Internal Ids value
        let seq_aa = unsafe {
            let array = *(aa[(offset_aa)..].as_ptr() as *const [_; 8]);
            mem::transmute::<[u8; 8], u64>(array)
        };
        let seq_bb = unsafe {
            let array = *(bb[(offset_bb)..].as_ptr() as *const [_; 8]);
            mem::transmute::<[u8; 8], u64>(array)
        };
        let seq_compare = seq_aa.cmp(&seq_bb);
        if seq_compare != Ordering::Equal {
            return seq_compare;
        }

        // Internal Ids are the same, compare the bounding box
        let bbox_aa = unsafe {
            let array = *(aa[(offset_aa + 8)..].as_ptr() as *const [_; 32]);
            mem::transmute::<[u8; 32], [f64; 4]>(array)
        };
        let bbox_bb = unsafe {
            let array = *(bb[(offset_bb + 8)..].as_ptr() as *const [_; 32]);
            mem::transmute::<[u8; 32], [f64; 4]>(array)
        };

        for (value_aa, value_bb) in bbox_aa.iter().zip(bbox_bb.iter()) {
            let value_compare = value_aa.partial_cmp(value_bb).unwrap();
            if value_compare != Ordering::Equal {
                return value_compare;
            }
        }
        // No early return, the values are fully equal
        Ordering::Equal
    }
/// Compare function for RocksDB for the keys in the R-tree
/// The keys have a length prefixed string (the Keypath), followed by the Interan Id and
/// the bounding box around the geometry
Compare function for RocksDB for the keys in the R-tree
The keys have a length prefixed string (the Keypath), followed by the Interan Id and
the bounding box around the geometry
Compare function for RocksDB for the keys in the R - tree The keys have a length prefixed string ( the Keypath ) followed by the Interan Id and the bounding box around the geometry
fn compare_keys_rtree(aa: &[u8], bb: &[u8]) -> Ordering {
        if aa.is_empty() && bb.is_empty() {
            return Ordering::Equal;
        } else if aa.is_empty() {
            return Ordering::Less;
        } else if bb.is_empty() {
            return Ordering::Greater;
        }
        let (keypath_aa, offset_aa) = Index::get_length_prefixed_slice(aa);
        let (keypath_bb, offset_bb) = Index::get_length_prefixed_slice(bb);
        // The ordering of the keypath doesn't need to be unicode collated. The ordering
        // doesn't really matters, it only matters that it's always the same.
        let keypath_compare = keypath_aa.cmp(keypath_bb);
        if keypath_compare != Ordering::Equal {
            return keypath_compare;
        }
        // Keypaths are the same, compare the Internal Ids value
        let seq_aa = unsafe {
            let array = *(aa[(offset_aa)..].as_ptr() as *const [_; 8]);
            mem::transmute::<[u8; 8], u64>(array)
        };
        let seq_bb = unsafe {
            let array = *(bb[(offset_bb)..].as_ptr() as *const [_; 8]);
            mem::transmute::<[u8; 8], u64>(array)
        };
        let seq_compare = seq_aa.cmp(&seq_bb);
        if seq_compare != Ordering::Equal {
            return seq_compare;
        }
        // Internal Ids are the same, compare the bounding box
        let bbox_aa = unsafe {
            let array = *(aa[(offset_aa + 8)..].as_ptr() as *const [_; 32]);
            mem::transmute::<[u8; 32], [f64; 4]>(array)
        };
        let bbox_bb = unsafe {
            let array = *(bb[(offset_bb + 8)..].as_ptr() as *const [_; 32]);
            mem::transmute::<[u8; 32], [f64; 4]>(array)
        };
        for (value_aa, value_bb) in bbox_aa.iter().zip(bbox_bb.iter()) {
            let value_compare = value_aa.partial_cmp(value_bb).unwrap();
            if value_compare != Ordering::Equal {
                return value_compare;
            }
        }
        // No early return, the values are fully equal
        Ordering::Equal
    }
fn compare_keys_rtree ( aa : & [ u8 ] , bb : & [ u8 ] ) -> Ordering { if aa . is_empty ( ) && bb . is_empty ( ) { return Ordering :: Equal ; } else if aa . is_empty ( ) { return Ordering :: Less ; } else if bb . is_empty ( ) { return Ordering :: Greater ; } let ( keypath_aa , offset_aa ) = Index :: get_length_prefixed_slice ( aa ) ; let ( keypath_bb , offset_bb ) = Index :: get_length_prefixed_slice ( bb ) ; // The ordering of the keypath doesn't need to be unicode collated. The ordering // doesn't really matters, it only matters that it's always the same. let keypath_compare = keypath_aa . cmp ( keypath_bb ) ; if keypath_compare != Ordering :: Equal { return keypath_compare ; } // Keypaths are the same, compare the Internal Ids value let seq_aa = unsafe { let array = * ( aa [ ( offset_aa ) .. ] . as_ptr ( ) as * const [ _ ; 8 ] ) ; mem :: transmute :: < [ u8 ; 8 ] , u64 > ( array ) } ; let seq_bb = unsafe { let array = * ( bb [ ( offset_bb ) .. ] . as_ptr ( ) as * const [ _ ; 8 ] ) ; mem :: transmute :: < [ u8 ; 8 ] , u64 > ( array ) } ; let seq_compare = seq_aa . cmp ( & seq_bb ) ; if seq_compare != Ordering :: Equal { return seq_compare ; } // Internal Ids are the same, compare the bounding box let bbox_aa = unsafe { let array = * ( aa [ ( offset_aa + 8 ) .. ] . as_ptr ( ) as * const [ _ ; 32 ] ) ; mem :: transmute :: < [ u8 ; 32 ] , [ f64 ; 4 ] > ( array ) } ; let bbox_bb = unsafe { let array = * ( bb [ ( offset_bb + 8 ) .. ] . as_ptr ( ) as * const [ _ ; 32 ] ) ; mem :: transmute :: < [ u8 ; 32 ] , [ f64 ; 4 ] > ( array ) } ; for ( value_aa , value_bb ) in bbox_aa . iter ( ) . zip ( bbox_bb . iter ( ) ) { let value_compare = value_aa . partial_cmp ( value_bb ) . unwrap ( ) ; if value_compare != Ordering :: Equal { return value_compare ; } } // No early return, the values are fully equal Ordering :: Equal }
Compare function for RocksDB for the keys in the R-tree
The keys have a length prefixed string (the Keypath), followed by the Interan Id and
the bounding box around the geometry
Compare function for RocksDB for the keys in the R - tree The keys have a length prefixed string ( the Keypath ) followed by the Interan Id and the bounding box around the geometry
aa
&[u8]
bb
&[u8]
aa
&[u8]
bb
&[u8]