pub struct QueryBuilder<'d> { /* private fields */ }Expand description
A builder for configuring and executing dictionary lookups.
Implementations§
Source§impl<'d> QueryBuilder<'d>
impl<'d> QueryBuilder<'d>
Sourcepub fn common_only(self, common: bool) -> Self
pub fn common_only(self, common: bool) -> Self
Filter to entries where any KanjiEntry or KanaEntry has common: true.
Sourcepub fn pos(self, pos: &[&str]) -> Self
pub fn pos(self, pos: &[&str]) -> Self
Filter to entries with matching part_of_speech values in any SenseEntry.
Sourcepub fn misc(self, misc: &[&str]) -> Self
pub fn misc(self, misc: &[&str]) -> Self
Filter to entries with any of the given JMdict misc codes
(e.g. "uk" for “usually written in kana”, "abbr" for abbreviation).
Sourcepub fn field(self, field: &[&str]) -> Self
pub fn field(self, field: &[&str]) -> Self
Filter to entries with any of the given JMdict field codes
(e.g. "med" for medicine, "comp" for computing).
Sourcepub fn dialect(self, dialect: &[&str]) -> Self
pub fn dialect(self, dialect: &[&str]) -> Self
Filter to entries with any of the given JMdict dialect codes
(e.g. "ksb" for Kansai-ben, "ktb" for Kantou-ben).
Sourcepub fn max_distance(self, n: u32) -> Self
pub fn max_distance(self, n: u32) -> Self
Set the maximum edit distance for fuzzy search (default: 2).
Clamped to a maximum of MAX_FUZZY_DISTANCE to keep the Levenshtein DFA
from blowing up — the automaton’s state space grows quickly with distance.
Sourcepub fn execute(self) -> Result<Vec<LookupResult>, JmdictError>
pub fn execute(self) -> Result<Vec<LookupResult>, JmdictError>
Execute the query and return all results collected into a Vec.
Sourcepub fn execute_iter(self) -> Result<LookupResultIter<'d>, JmdictError>
pub fn execute_iter(self) -> Result<LookupResultIter<'d>, JmdictError>
Execute the query and return a lazy iterator that deserializes entries on demand.
This is more memory-efficient than execute() for large result sets (e.g., prefix
or fuzzy queries with many matches), as entries are only deserialized as consumed.