Struct TwoWaySearcher

pub(in ::str::pattern) struct TwoWaySearcher { pub(in ::str::pattern) crit_pos: usize, pub(in ::str::pattern) crit_pos_back: usize, pub(in ::str::pattern) period: usize, pub(in ::str::pattern) byteset: u64, pub(in ::str::pattern) position: usize, pub(in ::str::pattern) end: usize, pub(in ::str::pattern) memory: usize, pub(in ::str::pattern) memory_back: usize }

The internal state of the two-way substring search algorithm.

Fields

crit_pos: usize

critical factorization index

crit_pos_back: usize

critical factorization index for reversed needle

period: usize
byteset: u64

byteset is an extension (not part of the two way algorithm); it's a 64-bit "fingerprint" where each set bit j corresponds to a (byte & 63) == j present in the needle.

position: usize
end: usize
memory: usize

index into needle before which we have already matched

memory_back: usize

index into needle after which we have already matched

Implementations

impl TwoWaySearcher

fn new(needle: &[u8], end: usize) -> TwoWaySearcher
fn byteset_create(bytes: &[u8]) -> u64
fn byteset_contains(&self, byte: u8) -> bool
fn next<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> S::Output
where
    S: TwoWayStrategy,
fn next_back<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> S::Output
where
    S: TwoWayStrategy,
fn maximal_suffix(arr: &[u8], order_greater: bool) -> (usize, usize)
fn reverse_maximal_suffix(arr: &[u8], known_period: usize, order_greater: bool) -> usize

Trait Implementations

impl Clone for TwoWaySearcher

fn clone(&self) -> TwoWaySearcher

impl Debug for TwoWaySearcher

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl Freeze for TwoWaySearcher

impl RefUnwindSafe for TwoWaySearcher

impl Send for TwoWaySearcher

impl Sync for TwoWaySearcher

impl Unpin for TwoWaySearcher

impl UnsafeUnpin for TwoWaySearcher

impl UnwindSafe for TwoWaySearcher

Blanket Implementations

impl<T> Any for TwoWaySearcher where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for TwoWaySearcher where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for TwoWaySearcher where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for TwoWaySearcher where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for TwoWaySearcher

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for TwoWaySearcher where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for TwoWaySearcher

impl<T, U> Into<U> for TwoWaySearcher where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for TwoWaySearcher where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for TwoWaySearcher where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>