diff --git a/clap_complete/src/dynamic/env/mod.rs b/clap_complete/src/dynamic/env/mod.rs index be736e759b5..a54e72b6295 100644 --- a/clap_complete/src/dynamic/env/mod.rs +++ b/clap_complete/src/dynamic/env/mod.rs @@ -232,7 +232,7 @@ pub struct Shells<'s>(pub &'s [&'s dyn EnvCompleter]); impl<'s> Shells<'s> { /// Select all of the built-in shells - pub fn builtins() -> Self { + pub const fn builtins() -> Self { Self(&[&Bash, &Elvish, &Fish, &Powershell, &Zsh]) } @@ -245,6 +245,11 @@ impl<'s> Shells<'s> { pub fn names(&self) -> impl Iterator + 's { self.0.iter().map(|c| c.name()) } + + /// Iterate over [`EnvCompleter`]s + pub fn iter(&self) -> impl Iterator { + self.0.iter().copied() + } } /// Shell-integration for completions