pub struct DictQueryResult { /* private fields */ }Expand description
Result of a translation query
Implementations§
Source§impl DictQueryResult
impl DictQueryResult
Sourcepub fn entries(&self) -> &[DictEntry]
pub fn entries(&self) -> &[DictEntry]
Returns a slice of all entries found in the query.
Examples found in repository?
examples/entry.rs (line 10)
5fn main() {
6 let dict = Dict::create("test/database/test_database.txt").unwrap();
7
8 let query_result = dict.query("Wort").execute().unwrap();
9
10 for entry in query_result.entries() {
11 println!("Plain word: {}", entry.left_word.plain_word());
12 println!("The word with optional parts: {}", entry.left_word.word_with_optional_parts());
13 println!("Acronyms: {:?}", entry.left_word.acronyms());
14 println!("Comments: {:?}", entry.left_word.comments());
15 println!("Gender Tags: {:?}", entry.left_word.genders());
16 }
17
18 // Pretty table printing
19 println!("{}", query_result.into_grouped());
20}Sourcepub fn into_grouped(self) -> DictQueryResultGrouped
pub fn into_grouped(self) -> DictQueryResultGrouped
Converts a DictQueryResult into a grouped representation used for structured display of the found entries.
Examples found in repository?
More examples
examples/entry.rs (line 19)
5fn main() {
6 let dict = Dict::create("test/database/test_database.txt").unwrap();
7
8 let query_result = dict.query("Wort").execute().unwrap();
9
10 for entry in query_result.entries() {
11 println!("Plain word: {}", entry.left_word.plain_word());
12 println!("The word with optional parts: {}", entry.left_word.word_with_optional_parts());
13 println!("Acronyms: {:?}", entry.left_word.acronyms());
14 println!("Comments: {:?}", entry.left_word.comments());
15 println!("Gender Tags: {:?}", entry.left_word.genders());
16 }
17
18 // Pretty table printing
19 println!("{}", query_result.into_grouped());
20}Trait Implementations§
Source§impl Clone for DictQueryResult
impl Clone for DictQueryResult
Source§fn clone(&self) -> DictQueryResult
fn clone(&self) -> DictQueryResult
Returns a duplicate of the value. Read more
1.0.0 · 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 DictQueryResult
impl Debug for DictQueryResult
Source§impl From<DictQueryResult> for DictQueryResultGrouped
impl From<DictQueryResult> for DictQueryResultGrouped
Source§fn from(query_result: DictQueryResult) -> Self
fn from(query_result: DictQueryResult) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DictQueryResult
impl PartialEq for DictQueryResult
impl Eq for DictQueryResult
impl StructuralPartialEq for DictQueryResult
Auto Trait Implementations§
impl Freeze for DictQueryResult
impl RefUnwindSafe for DictQueryResult
impl Send for DictQueryResult
impl Sync for DictQueryResult
impl Unpin for DictQueryResult
impl UnwindSafe for DictQueryResult
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,
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>
Converts
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>
Converts
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