pub struct QueryEngine { /* private fields */ }Expand description
The query of one query view: its local index, its remote sources, and what it has found so far.
Implementations§
Source§impl QueryEngine
impl QueryEngine
Sourcepub fn new(kinds: Vec<KindDecl>) -> Self
pub fn new(kinds: Vec<KindDecl>) -> Self
An engine for items of kinds, which also order the groups. It runs
remote requests on the executor current now and wakes the window it
is made in when they answer.
Sourcepub fn set_local_source(&mut self, source: Option<Arc<dyn LocalSource>>)
pub fn set_local_source(&mut self, source: Option<Arc<dyn LocalSource>>)
Answer with source too, beside the local items; None stops. What
it finds for the open query joins the rows after those shown.
Sourcepub fn with_remote(self, source: Arc<dyn RemoteSource>) -> Self
pub fn with_remote(self, source: Arc<dyn RemoteSource>) -> Self
Ask source too, in a section below the local results.
Sourcepub fn with_background(self, background: Background) -> Self
pub fn with_background(self, background: Background) -> Self
Run remote requests on background instead (a test’s pumped
executor).
Sourcepub fn set_waker(&mut self, wake: WakeHandle)
pub fn set_waker(&mut self, wake: WakeHandle)
Wake wake’s window when a remote answer arrives or a request falls
due, in place of the one current when the engine was made.
Sourcepub fn sync_local(&mut self, items: impl IntoIterator<Item = Item>)
pub fn sync_local(&mut self, items: impl IntoIterator<Item = Item>)
Take items as the app’s whole local set; only what changed is
indexed again. The rows an open query shows follow the change where
they stand: a row whose item changed shows it changed (liked now), a
row whose item left or no longer matches goes, and nothing new comes
in above the rows below it until the query changes. Liking a
catalogue song in the results brings it and its album into the
library, and neither may push the row the person just pressed from
under the pointer.
Prose (Item::body) is indexed off the UI thread when the bodies
change; the matches in it join the open query’s rows when it lands
(Self::poll), after the rows shown.
Sourcepub fn warm(&mut self)
pub fn warm(&mut self)
The person focused the search field: open the remote sources’ connections before the first character.
Sourcepub fn set_query(&mut self, query: QuerySpec) -> bool
pub fn set_query(&mut self, query: QuerySpec) -> bool
Ask query. The local results are in Self::results when this
returns; remote ones follow through Self::poll. Asking what is
asked already changes nothing. Returns whether the results changed.
Sourcepub fn retry(&mut self, source: &str) -> bool
pub fn retry(&mut self, source: &str) -> bool
Ask remote source source again for the open query, after it
could not answer: its section waits again, its placeholder timed
from now. Whether it was asked.
Sourcepub fn facet_offers(&self) -> Vec<FacetOffer>
pub fn facet_offers(&self) -> Vec<FacetOffer>
The open query’s filter chips, each value filter’s values counted among what the query finds without that filter’s own choice: the library searched again without it, and the remote rows shown.
pub fn is_open(&self) -> bool
Sourcepub fn results(&self) -> &QueryResults
pub fn results(&self) -> &QueryResults
What the query has found so far.
Sourcepub fn timings(&self) -> &QueryTimings
pub fn timings(&self) -> &QueryTimings
How long the open query took to show what it has.
Auto Trait Implementations§
impl !Freeze for QueryEngine
impl !RefUnwindSafe for QueryEngine
impl Send for QueryEngine
impl !Sync for QueryEngine
impl Unpin for QueryEngine
impl UnsafeUnpin for QueryEngine
impl !UnwindSafe for QueryEngine
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
§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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
§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