Struct clap_complete::ArgValueCompleter
source · pub struct ArgValueCompleter(/* private fields */);Available on crate feature
unstable-dynamic only.Expand description
Extend Arg with a CustomCompleter
§Example
use clap::Parser;
use clap_complete::dynamic::{ArgValueCompleter, CompletionCandidate};
#[derive(Debug, Parser)]
struct Cli {
#[arg(long, add = ArgValueCompleter::new(|| { vec![
CompletionCandidate::new("foo"),
CompletionCandidate::new("bar"),
CompletionCandidate::new("baz")] }))]
custom: Option<String>,
}Implementations§
source§impl ArgValueCompleter
impl ArgValueCompleter
sourcepub fn new<C>(completer: C) -> Selfwhere
C: CustomCompleter + 'static,
pub fn new<C>(completer: C) -> Selfwhere
C: CustomCompleter + 'static,
Create a new ArgValueCompleter with a custom completer
sourcepub fn candidates(&self) -> Vec<CompletionCandidate>
pub fn candidates(&self) -> Vec<CompletionCandidate>
All potential candidates for an argument.
See CompletionCandidate for more information.
Trait Implementations§
source§impl Clone for ArgValueCompleter
impl Clone for ArgValueCompleter
source§fn clone(&self) -> ArgValueCompleter
fn clone(&self) -> ArgValueCompleter
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ArgValueCompleter
impl Debug for ArgValueCompleter
impl ArgExt for ArgValueCompleter
Auto Trait Implementations§
impl Freeze for ArgValueCompleter
impl !RefUnwindSafe for ArgValueCompleter
impl Send for ArgValueCompleter
impl Sync for ArgValueCompleter
impl Unpin for ArgValueCompleter
impl !UnwindSafe for ArgValueCompleter
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)