clap_dyn_complete

Trait CustomCompleterFactory

Source
pub trait CustomCompleterFactory: Send + Sync {
    type CustomCompleter: CustomCompleter + 'static;

    // Required method
    fn build(
        &self,
        ctx: &RootCtx<'_>,
    ) -> impl Future<Output = Self::CustomCompleter>;
}
Expand description

A factory for CustomCompleters.

Having a two-step construction flow is useful to avoid constantly re-initializing “expensive” objects during custom completion (e.g: re-parsing a TOML file on every invocation to CustomComplete::complete).

Required Associated Types§

Required Methods§

Source

fn build( &self, ctx: &RootCtx<'_>, ) -> impl Future<Output = Self::CustomCompleter>

Build a new CustomCompleter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CustomCompleterFactory for ()

Source§

type CustomCompleter = ()

Source§

async fn build(&self, _ctx: &RootCtx<'_>) -> Self::CustomCompleter

Implementors§