Struct FnProvider
pub struct FnProvider<F> { /* private fields */ }Expand description
A SearchProvider built from a closure plus its kind label — the
convenient way to register a source without declaring a struct. Created via
SearchRegistry::register_fn.
Implementations§
§impl<F> FnProvider<F>
impl<F> FnProvider<F>
pub fn new(name: impl Into<String>, f: F) -> FnProvider<F>
Trait Implementations§
§impl<F> SearchProvider for FnProvider<F>
impl<F> SearchProvider for FnProvider<F>
§fn name(&self) -> &str
fn name(&self) -> &str
The kind label this provider produces, used for diagnostics and as the
default group header. Individual results may still carry a different
SearchResult::kind.§fn search(&self, query: &str) -> Vec<SearchResult>
fn search(&self, query: &str) -> Vec<SearchResult>
Return the matching results for
query. An empty query conventionally
returns a provider’s “browse” set (recents / favourites / all), or an
empty vec if browsing makes no sense for the source.§fn action_directory_generation(&self) -> Option<u64>
fn action_directory_generation(&self) -> Option<u64>
Monotonic retained-index generation for the broker pull directory.
None means the provider has not proved that a continuation cursor is
safe across mutation, so remote directory discovery must omit it
rather than silently advertise mutable rows as revision-stable.
Providers backed by SearchCatalog should return
Some(catalog.stats().generation).§fn action_directory_invocation_domain(&self) -> ActionDirectoryInvocationDomain
fn action_directory_invocation_domain(&self) -> ActionDirectoryInvocationDomain
Versions this actual provider’s complete lazy invocation domain, including
hidden targets and argument/handler semantics omitted from search rows.
§fn action_directory_cursor_is_current(&self, _cursor: &SearchCursor) -> bool
fn action_directory_cursor_is_current(&self, _cursor: &SearchCursor) -> bool
Validate a continuation token before it is used by a remote pull
directory. The conservative default refuses it: only providers that
expose a retained generation may claim continuation safety.
§fn search_limited(&self, query: &str, limit: usize) -> Vec<SearchResult>
fn search_limited(&self, query: &str, limit: usize) -> Vec<SearchResult>
Query with a materialisation budget. App providers must override this
and stop constructing hits once
limit is reached. The fallback exists
only for tiny/test providers outside apps/; the repository contract
checker rejects app implementations that inherit it.§fn search_page(
&self,
query: &SearchQuery,
cursor: Option<&SearchCursor>,
work_budget: usize,
result_limit: usize,
) -> SearchPage
fn search_page( &self, query: &SearchQuery, cursor: Option<&SearchCursor>, work_budget: usize, result_limit: usize, ) -> SearchPage
Return one bounded continuation page for an interactive search. Read more
§fn poll_page(&self, _token: &PendingToken) -> PagePoll
fn poll_page(&self, _token: &PendingToken) -> PagePoll
The page a
SearchPage::pending token stands for, once its source
has answered. Called on later frames, never in a loop; return
PagePoll::Pending until the answer is in. A token the provider no
longer knows (the query moved on) answers an empty ready page.§fn facets(&self) -> Vec<Facet>
fn facets(&self) -> Vec<Facet>
The dimensions this provider filters by. The palette offers their
values as chips and parses typed
key:value tokens for them into
SearchQuery::filters.§fn search_scopes(&self) -> Vec<ScopeDecl>
fn search_scopes(&self) -> Vec<ScopeDecl>
The parts of the app this provider’s hits can be narrowed to (see
ScopeDecl). An unscoped palette offers each as a
“Search in” row that narrows the search to it.§fn resolve_action_resource(&self, _address: &ActionAddress) -> Option<Resource>
fn resolve_action_resource(&self, _address: &ActionAddress) -> Option<Resource>
Lazily resolve a canonical search address that is intentionally absent
from the small open-resource snapshot.
Auto Trait Implementations§
impl<F> Freeze for FnProvider<F>where
F: Freeze,
impl<F> RefUnwindSafe for FnProvider<F>where
F: RefUnwindSafe,
impl<F> Send for FnProvider<F>where
F: Send,
impl<F> Sync for FnProvider<F>where
F: Sync,
impl<F> Unpin for FnProvider<F>where
F: Unpin,
impl<F> UnsafeUnpin for FnProvider<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FnProvider<F>where
F: UnwindSafe,
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
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync 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>
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