pub struct CompiledLikePattern { /* private fields */ }Expand description
A LIKE/ILIKE pattern compiled once for repeated evaluation.
ASCII values use a byte matcher without per-row allocation. Unicode keeps
SQL’s character-oriented _ semantics and the existing lowercase rules.
Implementations§
Source§impl CompiledLikePattern
impl CompiledLikePattern
pub fn new(pattern: &str, case_insensitive: bool) -> Self
pub fn from_value(pattern: &Value, case_insensitive: bool) -> Self
Sourcepub fn with_escape(
pattern: &str,
case_insensitive: bool,
escape: Option<&str>,
) -> Result<Self>
pub fn with_escape( pattern: &str, case_insensitive: bool, escape: Option<&str>, ) -> Result<Self>
Compile a pattern with PostgreSQL’s optional ESCAPE clause.
None selects the default backslash, while Some("") disables escaping.
pub fn is_match(&self, haystack: &str) -> bool
Sourcepub fn try_is_match(&self, haystack: &str) -> Result<bool>
pub fn try_is_match(&self, haystack: &str) -> Result<bool>
Match while preserving PostgreSQL errors such as a dangling escape.
pub fn matches_value(&self, haystack: &Value) -> bool
Sourcepub fn try_matches_value(&self, haystack: &Value) -> Result<bool>
pub fn try_matches_value(&self, haystack: &Value) -> Result<bool>
Match a value while preserving PostgreSQL pattern errors.
Auto Trait Implementations§
impl Freeze for CompiledLikePattern
impl RefUnwindSafe for CompiledLikePattern
impl Send for CompiledLikePattern
impl Sync for CompiledLikePattern
impl Unpin for CompiledLikePattern
impl UnsafeUnpin for CompiledLikePattern
impl UnwindSafe for CompiledLikePattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more