pub struct IdMulti {
providers: HashMap<String, Box<dyn SuggestionProvider>>,
}
Expand description
A provider that aggregates suggestions from suggesters that tracks an ID per suggester (or suggester tree).
Fields
providers: HashMap<String, Box<dyn SuggestionProvider>>
The providers to aggregate from.
Implementations
sourceimpl IdMulti
impl IdMulti
sourcepub fn new(providers: HashMap<String, Box<dyn SuggestionProvider>>) -> Self
pub fn new(providers: HashMap<String, Box<dyn SuggestionProvider>>) -> Self
Create a Multi
that draws suggestions from providers
.
sourcepub fn add_provider(
&mut self,
name: String,
provider: Box<dyn SuggestionProvider>
) -> &mut Self
pub fn add_provider(
&mut self,
name: String,
provider: Box<dyn SuggestionProvider>
) -> &mut Self
Modify this provider to include another named provider tree.
sourcepub fn list_providers(&self) -> Vec<ProviderDetails>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn list_providers(&self) -> Vec<ProviderDetails>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Return metadata about the contained providers.
sourcepub async fn suggest_from_ids(
&self,
request: SuggestionRequest,
ids: &HashSet<String>
) -> Result<SuggestionResponse, SuggestError>
pub async fn suggest_from_ids(
&self,
request: SuggestionRequest,
ids: &HashSet<String>
) -> Result<SuggestionResponse, SuggestError>
Provide suggested results for query
using only the providers listed by ID.
Errors
Returns an error if any sub providers return an error.
sourcepub fn get_provider_mut(
&mut self,
name: &str
) -> Option<&mut Box<dyn SuggestionProvider>>
pub fn get_provider_mut(
&mut self,
name: &str
) -> Option<&mut Box<dyn SuggestionProvider>>
Get a mutable reference to a provider by name.
Trait Implementations
sourceimpl SuggestionProvider for IdMulti
impl SuggestionProvider for IdMulti
sourcefn cache_inputs(
&self,
req: &SuggestionRequest,
cache_inputs: &mut dyn CacheInputs
)
fn cache_inputs(
&self,
req: &SuggestionRequest,
cache_inputs: &mut dyn CacheInputs
)
Generate a set of cache inputs for a given query specific to this provider. Any property of the query that affects how suggestions are generated should be included. Read more
sourcefn suggest<'life0, 'async_trait>(
&'life0 self,
request: SuggestionRequest
) -> Pin<Box<dyn Future<Output = Result<SuggestionResponse, SuggestError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn suggest<'life0, 'async_trait>(
&'life0 self,
request: SuggestionRequest
) -> Pin<Box<dyn Future<Output = Result<SuggestionResponse, SuggestError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Provide suggested results for query
.
sourcefn reconfigure<'life0, 'life1, 'async_trait>(
&'life0 mut self,
new_config: Value,
make_fresh: &'life1 MakeFreshType
) -> Pin<Box<dyn Future<Output = Result<(), SetupError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn reconfigure<'life0, 'life1, 'async_trait>(
&'life0 mut self,
new_config: Value,
make_fresh: &'life1 MakeFreshType
) -> Pin<Box<dyn Future<Output = Result<(), SetupError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Reconfigure the provider, using a new configuration object. State should be preserved if possible. Read more
sourcefn is_null(&self) -> bool
fn is_null(&self) -> bool
Return if this provider is null and can be ignored. Providers that set this to true should be ignored in any place where suggestions are needed. Providers with this set to true likely only serve as a blank space where we may need a provider but can’t otherwise supply one. Read more
sourcefn cache_key(&self, req: &SuggestionRequest) -> String
fn cache_key(&self, req: &SuggestionRequest) -> String
Use Self::cache_inputs
to generate a single cache key. This function
should not normally be overridden by provider implementations. Read more
Auto Trait Implementations
impl !RefUnwindSafe for IdMulti
impl Send for IdMulti
impl Sync for IdMulti
impl Unpin for IdMulti
impl !UnwindSafe for IdMulti
Blanket Implementations
sourceimpl<'a, T, E> AsTaggedExplicit<'a, E> for T where
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for T where
T: 'a,
sourceimpl<'a, T, E> AsTaggedImplicit<'a, E> for T where
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for T where
T: 'a,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more