fn prefix_suffix(&mut self,
                     match_pairs: &mut Vec<MatchPair<'tcx>>,
                     lvalue: Lvalue<'tcx>,
                     prefix: Vec<PatternRef<'tcx>>,
                     suffix: Vec<PatternRef<'tcx>>) {
        let min_length = prefix.len() + suffix.len();
        assert!(min_length < u32::MAX as usize);
        let min_length = min_length as u32;

        let prefix_pairs: Vec<_> =
            prefix.into_iter()
                  .enumerate()
                  .map(|(idx, subpattern)| {
                      let elem = ProjectionElem::ConstantIndex {
                          offset: idx as u32,
                          min_length: min_length,
                          from_end: false,
                      };
                      let lvalue = lvalue.clone().elem(elem);
                      self.match_pair(lvalue, subpattern)
                  })
                  .collect();

        let suffix_pairs: Vec<_> =
            suffix.into_iter()
                  .rev()
                  .enumerate()
                  .map(|(idx, subpattern)| {
                      let elem = ProjectionElem::ConstantIndex {
                          offset: (idx+1) as u32,
                          min_length: min_length,
                          from_end: true,
                      };
                      let lvalue = lvalue.clone().elem(elem);
                      self.match_pair(lvalue, subpattern)
                  })
                  .collect();

        match_pairs.extend(prefix_pairs.into_iter().chain(suffix_pairs));
    }
/// Helper for `prefix_suffix_slice` which just processes the prefix and suffix.
Helper for `prefix_suffix_slice` which just processes the prefix and suffix.
Helper for ` prefix_suffix_slice ` which just processes the prefix and suffix .
fn prefix_suffix(&mut self,
                     match_pairs: &mut Vec<MatchPair<'tcx>>,
                     lvalue: Lvalue<'tcx>,
                     prefix: Vec<PatternRef<'tcx>>,
                     suffix: Vec<PatternRef<'tcx>>) {
        let min_length = prefix.len() + suffix.len();
        assert!(min_length < u32::MAX as usize);
        let min_length = min_length as u32;
        let prefix_pairs: Vec<_> =
            prefix.into_iter()
                  .enumerate()
                  .map(|(idx, subpattern)| {
                      let elem = ProjectionElem::ConstantIndex {
                          offset: idx as u32,
                          min_length: min_length,
                          from_end: false,
                      };
                      let lvalue = lvalue.clone().elem(elem);
                      self.match_pair(lvalue, subpattern)
                  })
                  .collect();
        let suffix_pairs: Vec<_> =
            suffix.into_iter()
                  .rev()
                  .enumerate()
                  .map(|(idx, subpattern)| {
                      let elem = ProjectionElem::ConstantIndex {
                          offset: (idx+1) as u32,
                          min_length: min_length,
                          from_end: true,
                      };
                      let lvalue = lvalue.clone().elem(elem);
                      self.match_pair(lvalue, subpattern)
                  })
                  .collect();
        match_pairs.extend(prefix_pairs.into_iter().chain(suffix_pairs));
    }
fn prefix_suffix ( & mut self , match_pairs : & mut Vec < MatchPair < ' tcx > > , lvalue : Lvalue < ' tcx > , prefix : Vec < PatternRef < ' tcx > > , suffix : Vec < PatternRef < ' tcx > > ) { let min_length = prefix . len ( ) + suffix . len ( ) ; assert ! ( min_length u32 MAX as usize ) ; let min_length = min_length as u32 ; let prefix_pairs : Vec < _ > = prefix . into_iter ( ) . enumerate ( ) . map ( | ( idx , subpattern ) | { let elem = ProjectionElem :: ConstantIndex { offset : idx as u32 , min_length : min_length , from_end : false , } ; let lvalue = lvalue . clone ( ) . elem ( elem ) ; self . match_pair ( lvalue , subpattern ) } ) . collect ( ) ; let suffix_pairs : Vec < _ > = suffix . into_iter ( ) . rev ( ) . enumerate ( ) . map ( | ( idx , subpattern ) | { let elem = ProjectionElem :: ConstantIndex { offset : ( idx + 1 ) as u32 , min_length : min_length , from_end : true , } ; let lvalue = lvalue . clone ( ) . elem ( elem ) ; self . match_pair ( lvalue , subpattern ) } ) . collect ( ) ; match_pairs . extend ( prefix_pairs . into_iter ( ) . chain ( suffix_pairs ) ) ; }
Helper for `prefix_suffix_slice` which just processes the prefix and suffix.
Helper for ` prefix_suffix_slice ` which just processes the prefix and suffix .
&mut self
match_pairs
&mut Vec<MatchPair<'tcx>>
lvalue
Lvalue<'tcx>
prefix
Vec<PatternRef<'tcx>>
suffix
Vec<PatternRef<'tcx>>