Skip to main content

SuggestionProvider

Trait SuggestionProvider 

Source
pub trait SuggestionProvider: Send + Sync {
    // Required method
    fn list_suggestions(
        &self,
        context: &CommandSuggestionContext<'_>,
        builder: &mut SuggestionsBuilder<'_>,
    );
}
Expand description

A provider to add suggestions to a builder. This is useful to override the suggestions of a specific argument in a command to follow this provider.

Functions that have the same function signature as that of SuggestionProvider::list_suggestions also implement this trait.

Required Methods§

Source

fn list_suggestions( &self, context: &CommandSuggestionContext<'_>, builder: &mut SuggestionsBuilder<'_>, )

Adds suggestions, according to this provider, to the given builder.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> SuggestionProvider for F
where F: for<'a> Fn(&CommandSuggestionContext<'_>, &mut SuggestionsBuilder<'a>) + Send + Sync,