pub struct Filter {
pub text: String,
pub min_rating: Option<u8>,
pub labels: Vec<ColorLabel>,
pub flags: Vec<Flag>,
pub tags: Vec<String>,
pub from: Option<String>,
pub to: Option<String>,
}Expand description
What the application filters its images by. Empty criteria filter nothing; all criteria must hold (labels and flags: any of them; tags: all of them).
Fields§
§text: StringWords, each found in the name or a tag (ignoring case).
min_rating: Option<u8>At least this many stars.
labels: Vec<ColorLabel>One of these labels.
flags: Vec<Flag>One of these flags.
All of these tags.
from: Option<String>From this day (YYYY-MM-DD), included.
to: Option<String>Until this day, included.
Implementations§
Source§impl Filter
impl Filter
pub fn is_empty(&self) -> bool
Sourcepub fn parse(text: &str) -> Filter
pub fn parse(text: &str) -> Filter
The criteria typed in text, the other words kept as the text.
The text is cut at the spaces outside quotes (split_terms), so
a value may hold spaces when quoted: tag:"New York", #"a b"
(the spaces kept as typed). Inside quotes, \" is a quote and
\\ before a quote is a backslash (read_value). The words
that are no criterion stay as typed, quotes included.
Self::to_text writes a filter back so that this reads it
whole.
Sourcepub fn to_text(&self) -> String
pub fn to_text(&self) -> String
The filter as text, Self::parse reading it back as it is: the
criteria (rating>=3 label:red flag:pick tag:"New York" date:2024-06-01..2024-06-30), then the words. Tag values are
quoted when they need it (value_text); the words are written
as they are, being already in the grammar.
Sourcepub fn merged(&self, other: &Filter) -> Filter
pub fn merged(&self, other: &Filter) -> Filter
This filter with other’s criteria added (its text after this
one’s).
Sourcepub fn chips(&self) -> Vec<FilterChip>
pub fn chips(&self) -> Vec<FilterChip>
Its criteria as chips (the text is not one).
Sourcepub fn remove(&mut self, chip: &FilterChip)
pub fn remove(&mut self, chip: &FilterChip)
Without that criterion.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Filter
impl<'de> Deserialize<'de> for Filter
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Filter
impl StructuralPartialEq for Filter
Auto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnsafeUnpin for Filter
impl UnwindSafe for Filter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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