pub enum MatchQuality {
Prefix,
WordStart,
Substring,
None,
}Expand description
How well a query matched an item’s name — better matches sort first.
Ordered by discriminant: Prefix is the strongest. Derived Ord gives the
comparison for free, so adding a tier in the right position is all it takes.
Variants§
Prefix
The name starts with the query — “parks” in “Parks and Recreation”.
WordStart
Some later word starts with the query — “recreation” in “Parks and Recreation”. Still a deliberate hit: users type whole words.
Substring
The query appears mid-word — “parks” in “Sparks of Love”. Weakest hit that still counts as a match.
None
No match on the name at all. The backend returned it for some other reason (overview, artist, album), so it is kept but sorted last.
Trait Implementations§
Source§impl Clone for MatchQuality
impl Clone for MatchQuality
Source§fn clone(&self) -> MatchQuality
fn clone(&self) -> MatchQuality
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MatchQuality
impl Debug for MatchQuality
Source§impl Ord for MatchQuality
impl Ord for MatchQuality
Source§fn cmp(&self, other: &MatchQuality) -> Ordering
fn cmp(&self, other: &MatchQuality) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for MatchQuality
impl PartialEq for MatchQuality
Source§fn eq(&self, other: &MatchQuality) -> bool
fn eq(&self, other: &MatchQuality) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for MatchQuality
impl PartialOrd for MatchQuality
impl Copy for MatchQuality
impl Eq for MatchQuality
impl StructuralPartialEq for MatchQuality
Auto Trait Implementations§
impl Freeze for MatchQuality
impl RefUnwindSafe for MatchQuality
impl Send for MatchQuality
impl Sync for MatchQuality
impl Unpin for MatchQuality
impl UnsafeUnpin for MatchQuality
impl UnwindSafe for MatchQuality
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
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
Checks if this value is equivalent to the given key. Read more