unsafe fn fetch_next_aliased_unchecked(&mut self) -> Option<[QF::Item; K]>
    where
        QF: Clone,
        F::Fetch: Clone,
    {
        if K == 0 {
            return None;
        }

        // first, iterate from last to first until next item is found
        'outer: for i in (0..K).rev() {
            match self.cursors[i].next(self.tables, self.archetypes, self.query_state) {
                Some(_) => {
                    // walk forward up to last element, propagating cursor state forward
                    for j in (i + 1)..K {
                        self.cursors[j] = self.cursors[j - 1].clone();
                        match self.cursors[j].next(self.tables, self.archetypes, self.query_state) {
                            Some(_) => {}
                            None if i > 0 => continue 'outer,
                            None => return None,
                        }
                    }
                    break;
                }
                None if i > 0 => continue,
                None => return None,
            }
        }

        // TODO: use MaybeUninit::uninit_array if it stabilizes
        let mut values: [MaybeUninit<QF::Item>; K] = MaybeUninit::uninit().assume_init();

        for (value, cursor) in values.iter_mut().zip(&mut self.cursors) {
            value.as_mut_ptr().write(cursor.peek_last().unwrap());
        }

        // TODO: use MaybeUninit::array_assume_init if it stabilizes
        let values: [QF::Item; K] = (&values as *const _ as *const [QF::Item; K]).read();

        Some(values)
    }
/// Safety:
/// The lifetime here is not restrictive enough for Fetch with &mut access,
/// as calling `fetch_next_aliased_unchecked` multiple times can produce multiple
/// references to the same component, leading to unique reference aliasing.
///.
/// It is always safe for shared access.
The lifetime here is not restrictive enough for Fetch with &mut access,
as calling `fetch_next_aliased_unchecked` multiple times can produce multiple
references to the same component, leading to unique reference aliasing.
.
It is always safe for shared access.
The lifetime here is not restrictive enough for Fetch with &mut access as calling ` fetch_next_aliased_unchecked ` multiple times can produce multiple references to the same component leading to unique reference aliasing . . It is always safe for shared access .
unsafe fn fetch_next_aliased_unchecked(&mut self) -> Option<[QF::Item; K]>
    where
        QF: Clone,
        F::Fetch: Clone,
    {
        if K == 0 {
            return None;
        }
        // first, iterate from last to first until next item is found
        'outer: for i in (0..K).rev() {
            match self.cursors[i].next(self.tables, self.archetypes, self.query_state) {
                Some(_) => {
                    // walk forward up to last element, propagating cursor state forward
                    for j in (i + 1)..K {
                        self.cursors[j] = self.cursors[j - 1].clone();
                        match self.cursors[j].next(self.tables, self.archetypes, self.query_state) {
                            Some(_) => {}
                            None if i > 0 => continue 'outer,
                            None => return None,
                        }
                    }
                    break;
                }
                None if i > 0 => continue,
                None => return None,
            }
        }
        // TODO: use MaybeUninit::uninit_array if it stabilizes
        let mut values: [MaybeUninit<QF::Item>; K] = MaybeUninit::uninit().assume_init();
        for (value, cursor) in values.iter_mut().zip(&mut self.cursors) {
            value.as_mut_ptr().write(cursor.peek_last().unwrap());
        }
        // TODO: use MaybeUninit::array_assume_init if it stabilizes
        let values: [QF::Item; K] = (&values as *const _ as *const [QF::Item; K]).read();
        Some(values)
    }
unsafe fn fetch_next_aliased_unchecked ( & mut self ) -> Option < [ QF :: Item ; K ] > where QF : Clone , F :: Fetch : Clone , { if K == 0 { return None ; } // first, iterate from last to first until next item is found ' outer : for i in ( 0 .. K ) . rev ( ) { match self . cursors [ i ] . next ( self . tables , self . archetypes , self . query_state ) { Some ( _ ) => { // walk forward up to last element, propagating cursor state forward for j in ( i + 1 ) .. K { self . cursors [ j ] = self . cursors [ j - 1 ] . clone ( ) ; match self . cursors [ j ] . next ( self . tables , self . archetypes , self . query_state ) { Some ( _ ) => { } None if i > 0 => continue ' outer , None => return None , } } break ; } None if i > 0 => continue , None => return None , } } // TODO: use MaybeUninit::uninit_array if it stabilizes let mut values : [ MaybeUninit < QF :: Item > ; K ] = MaybeUninit :: uninit ( ) . assume_init ( ) ; for ( value , cursor ) in values . iter_mut ( ) . zip ( & mut self . cursors ) { value . as_mut_ptr ( ) . write ( cursor . peek_last ( ) . unwrap ( ) ) ; } // TODO: use MaybeUninit::array_assume_init if it stabilizes let values : [ QF :: Item ; K ] = ( & values as * const _ as * const [ QF :: Item ; K ] ) . read ( ) ; Some ( values ) }
Safety:
The lifetime here is not restrictive enough for Fetch with &mut access,
as calling `fetch_next_aliased_unchecked` multiple times can produce multiple
references to the same component, leading to unique reference aliasing.
Safety : The lifetime here is not restrictive enough for Fetch with &mut access as calling ` fetch_next_aliased_unchecked ` multiple times can produce multiple references to the same component leading to unique reference aliasing .
&mut self
&mut self