pub struct TextUtils;Expand description
Case-insensitive text operations without allocation when possible
Implementations§
Source§impl TextUtils
impl TextUtils
Sourcepub fn contains_ignore_case(text: &str, pattern: &str) -> bool
pub fn contains_ignore_case(text: &str, pattern: &str) -> bool
Check if text contains pattern (case-insensitive) without allocation
Sourcepub fn normalize_whitespace(text: &str) -> Cow<'_, str>
pub fn normalize_whitespace(text: &str) -> Cow<'_, str>
Normalize whitespace efficiently
Sourcepub fn count_words(text: &str) -> usize
pub fn count_words(text: &str) -> usize
Count words efficiently (no allocation)
Sourcepub fn truncate_with_ellipsis(text: &str, max_len: usize) -> Cow<'_, str>
pub fn truncate_with_ellipsis(text: &str, max_len: usize) -> Cow<'_, str>
Truncate text to max length with ellipsis if needed
Sourcepub fn is_significant_word(word: &str, min_len: usize) -> bool
pub fn is_significant_word(word: &str, min_len: usize) -> bool
Check if word is significant (not stop word, long enough)
Auto Trait Implementations§
impl Freeze for TextUtils
impl RefUnwindSafe for TextUtils
impl Send for TextUtils
impl Sync for TextUtils
impl Unpin for TextUtils
impl UnsafeUnpin for TextUtils
impl UnwindSafe for TextUtils
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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