Rindle docs and package mapSkip to main content

LikeMatcher

Struct LikeMatcher 

Source
pub struct LikeMatcher { /* private fields */ }
Expand description

A compiled SQL LIKE pattern (07 §4 / filter.ts). % matches any byte run, _ matches exactly one byte. Compiled once (the builder lowers the literal pattern) and matched per row with a classic backtracking glob walk.

Collation / escape policy (WS05.1):

  • \ escape is honoured, matching the SQL the builder emits (ESCAPE '\'): \%/\_/\\ are the literal %/_/\. So memory and SQLite agree for patterns that escape a wildcard.
  • Case-sensitive LIKE is byte-level; the SQLite leaf sets PRAGMA case_sensitive_like = ON so its bare LIKE agrees (both case-sensitive).
  • ILIKE folds ASCII-only (eq_ignore_ascii_case), which matches the bundled SQLite’s lower() (no ICU) — so memory and SQLite agree on ASCII. Non-ASCII case folding is a documented limitation (both leave non-ASCII bytes unfolded); revisit only if a corpus needs Unicode ILIKE.
  • _ is byte-level, not UTF-8-character-level (a deferred edge for non-ASCII single-char matches; the byte glob structure is correct and tested).

Implementations§

Source§

impl LikeMatcher

Source

pub fn compile(pattern: &[u8]) -> LikeMatcher

Compile a LIKE pattern. Adjacent literal bytes coalesce into one Lit run; runs of % collapse to a single Any.

Source

pub fn compile_case_insensitive(pattern: &[u8]) -> LikeMatcher

Compile a case-insensitive LIKE pattern (ILIKE).

Source

pub fn matches(&self, text: &[u8]) -> bool

Match text against the compiled pattern. Backtracking glob: Any records a restart point so a later mismatch can re-anchor % one byte further.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.