pub struct TextFilter<M> { /* private fields */ }Expand description
Text filter matching a String or Option<String> field by a term the user types, the way
a TextMatch names.
f.<name>=<term> matches by the first way the filter offers, Contains
unless matching says otherwise; f.<name>.op=<way> picks another it
offers. The match ignores case as the table’s search does: ILIKE on PostgreSQL, the
column’s collation on MySQL, and ASCII letters only on SQLite and Turso. % and _ match only
themselves. Excludes also matches a record whose optional
field holds nothing.
TextFilter::new(lens!(User.email)).matching([TextMatch::EndsWith, TextMatch::Is]);Implementations§
Source§impl<M> TextFilter<M>
impl<M> TextFilter<M>
Sourcepub fn new<T>(lens: impl Into<Path<M, T>>) -> TextFilter<M>where
T: FilterText,
pub fn new<T>(lens: impl Into<Path<M, T>>) -> TextFilter<M>where
T: FilterText,
Filter the string field lens binds by a term, every TextMatch offered.
Sourcepub fn label(self, label: impl Into<Text>) -> TextFilter<M>
pub fn label(self, label: impl Into<Text>) -> TextFilter<M>
The label the control renders, over the field’s.
Sourcepub fn matching(
self,
ways: impl IntoIterator<Item = TextMatch>,
) -> TextFilter<M>
pub fn matching( self, ways: impl IntoIterator<Item = TextMatch>, ) -> TextFilter<M>
Offer only ways, the first one applying to a term without an op part. One way hides
the control’s choice of way; none offers Contains alone.
Trait Implementations§
Source§impl<M> Clone for TextFilter<M>
impl<M> Clone for TextFilter<M>
Source§fn clone(&self) -> TextFilter<M>
fn clone(&self) -> TextFilter<M>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<M> Debug for TextFilter<M>
impl<M> Debug for TextFilter<M>
Source§impl<M> Filter<M> for TextFilter<M>
impl<M> Filter<M> for TextFilter<M>
Source§fn to_expr(&self, cx: &Cx, value: &FilterValue) -> Option<Expr<bool>>
fn to_expr(&self, cx: &Cx, value: &FilterValue) -> Option<Expr<bool>>
The match of the one term the value holds, the way its op part names; None for no
term or several, another part, or a way the filter does not offer.
Source§fn is_noop_value(&self, value: &FilterValue) -> bool
fn is_noop_value(&self, value: &FilterValue) -> bool
An op part alone is the control’s choice of way submitted with an empty term.
Source§fn control<'a>(&self, cx: &'a Cx, input: FilterInput) -> Pin<Box<dyn View + 'a>>
fn control<'a>(&self, cx: &'a Cx, input: FilterInput) -> Pin<Box<dyn View + 'a>>
A choice of way, when the filter offers several, beside the term’s input.
Source§fn load_control<'s, 'a>(
&'s self,
cx: &'a Cx,
input: FilterInput,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn View + 'a>>> + Send + 's>>where
'a: 's,
fn load_control<'s, 'a>(
&'s self,
cx: &'a Cx,
input: FilterInput,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn View + 'a>>> + Send + 's>>where
'a: 's,
control.