MCPcopy Create free account
hub / github.com/davidblewett/rure-python / next

Method next

regex/src/pattern.rs:32–61  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

30
31 #[inline]
32 fn next(&mut self) -> SearchStep {
33 if let Some((s, e)) = self.next_match {
34 self.next_match = None;
35 self.last_step_end = e;
36 return SearchStep::Match(s, e);
37 }
38 match self.it.next() {
39 None => {
40 if self.last_step_end < self.haystack().len() {
41 let last = self.last_step_end;
42 self.last_step_end = self.haystack().len();
43 SearchStep::Reject(last, self.haystack().len())
44 } else {
45 SearchStep::Done
46 }
47 }
48 Some(m) => {
49 let (s, e) = (m.start(), m.end());
50 if s == self.last_step_end {
51 self.last_step_end = e;
52 SearchStep::Match(s, e)
53 } else {
54 self.next_match = Some((s, e));
55 let last = self.last_step_end;
56 self.last_step_end = s;
57 SearchStep::Reject(last, s)
58 }
59 }
60 }
61 }
62}

Callers

nothing calls this directly

Calls 5

haystackMethod · 0.80
MatchClass · 0.70
lenMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected