Lines Matching refs:suffix

64     /// to beginning of either the minimal or maximal suffix in needle. (N.B.
398 /// suffix, along with the period of that suffix. It turns out that the period
399 /// of that suffix is a lower bound on the period of the needle itself.
403 /// `x = uv` and `v` is the lexicographic maximal suffix of `v`. The lower
406 /// where `u` is a suffix of `v[0..period(v)]`.
435 /// The lower bound on the period is then the period of the chosen suffix.
458 /// The lower bound on the period is then the period of the chosen suffix.
477 /// A suffix extracted from a needle along with its period.
480 /// The starting position of this suffix.
482 /// If this is a forward suffix, then `&bytes[pos..]` can be used. If this
483 /// is a reverse suffix, then `&bytes[..pos]` can be used. That is, for
487 /// The period of this suffix.
490 /// this suffix comes from. (It is always less than or equal to the period
499 // suffix represents our maximal (or minimal) suffix, along with
501 let mut suffix = Suffix { pos: 0, period: 1 };
502 // The start of a suffix in `needle` that we are considering as a
503 // more maximal (or minimal) suffix than what's in `suffix`.
510 // character than our current maximal (or minimal) suffix, then the
511 // current suffix is changed over to the candidate and we restart our
512 // search. Otherwise, the candidate suffix is no good and we restart
520 let current = needle[suffix.pos + offset];
524 suffix = Suffix { pos: candidate_start, period: 1 };
531 suffix.period = candidate_start - suffix.pos;
534 if offset + 1 == suffix.period {
535 candidate_start += suffix.period;
543 suffix
550 let mut suffix = Suffix { pos: needle.len(), period: 1 };
552 return suffix;
558 let current = needle[suffix.pos - offset - 1];
562 suffix = Suffix { pos: candidate_start, period: 1 };
569 suffix.period = suffix.pos - candidate_start;
572 if offset + 1 == suffix.period {
573 candidate_start -= suffix.period;
581 suffix
585 /// The kind of suffix to extract.
588 /// Extract the smallest lexicographic suffix from a string.
591 /// suffix. e.g., Given the choice between `a` and `aa`, this will choose
594 /// suffix.
596 /// Extract the largest lexicographic suffix from a string.
598 /// Unlike `Minimal`, this really does pick the maximum suffix. e.g., Given
608 /// suffix is better than the current maximal (or minimal) suffix. That is,
609 /// the current candidate suffix should supplant the current maximal (or
610 /// minimal) suffix.
612 /// This occurs when the given candidate byte excludes the candidate suffix
613 /// from being better than the current maximal (or minimal) suffix. That
614 /// is, the current candidate suffix should be dropped and the next one
617 /// This occurs when no decision to accept or skip the candidate suffix
625 /// it should replace the current suffix as the maximal (or minimal)
626 /// suffix.
679 /// Convenience wrapper for computing the suffix as a byte string.
685 /// Convenience wrapper for computing the reverse suffix as a byte string.
696 /// Return the lexicographically maximal suffix of the given byte string.
703 /// Return the lexicographically maximal suffix of the reverse of the given