pub struct Fields { /* private fields */ }Expand description
The fields of one thing a search field looks through (a setting, a
page), each of a Tier: labels and keywords are matched fuzzily
(score), descriptions by words and word prefixes
(word_prefix), so a long description does not match a word
whose letters it merely holds in order. Each field is matched on its
own: a word never spans two fields.
use egui_pop_model::fuzzy::{Fields, Tier};
let wrap = Fields::new()
.label("Soft wrap")
.description("Lines break at the pane's edge, so a paragraph reads without scrolling; the file itself remains unchanged.");
assert_eq!(wrap.find("swrp").unwrap().tier, Tier::Label);
assert_eq!(wrap.find("parag").unwrap().tier, Tier::Description);
assert!(wrap.find("specimen").is_none());Implementations§
Source§impl Fields
impl Fields
pub fn new() -> Self
Sourcepub fn field(self, tier: Tier, text: impl Into<String>) -> Self
pub fn field(self, tier: Tier, text: impl Into<String>) -> Self
A field of tier; empty text is left out.
pub fn label(self, text: impl Into<String>) -> Self
pub fn keyword(self, text: impl Into<String>) -> Self
pub fn keywords<S: Into<String>>( self, words: impl IntoIterator<Item = S>, ) -> Self
pub fn description(self, text: impl Into<String>) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Fields
impl RefUnwindSafe for Fields
impl Send for Fields
impl Sync for Fields
impl Unpin for Fields
impl UnsafeUnpin for Fields
impl UnwindSafe for Fields
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