pub struct ArgValueCandidates(/* private fields */);Available on crate feature
unstable-dynamic only.Expand description
Extend Arg with a ValueCandidates
§Example
use clap::Parser;
use clap_complete::engine::{ArgValueCandidates, CompletionCandidate};
#[derive(Debug, Parser)]
struct Cli {
#[arg(long, add = ArgValueCandidates::new(|| { vec![
CompletionCandidate::new("foo"),
CompletionCandidate::new("bar"),
CompletionCandidate::new("baz")] }))]
custom: Option<String>,
}Implementations§
Source§impl ArgValueCandidates
impl ArgValueCandidates
Sourcepub fn new<C>(completer: C) -> Selfwhere
C: ValueCandidates + 'static,
pub fn new<C>(completer: C) -> Selfwhere
C: ValueCandidates + 'static,
Create a new ArgValueCandidates 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 ArgValueCandidates
impl Clone for ArgValueCandidates
Source§fn clone(&self) -> ArgValueCandidates
fn clone(&self) -> ArgValueCandidates
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 ArgValueCandidates
impl Debug for ArgValueCandidates
impl ArgExt for ArgValueCandidates
Auto Trait Implementations§
impl Freeze for ArgValueCandidates
impl !RefUnwindSafe for ArgValueCandidates
impl Send for ArgValueCandidates
impl Sync for ArgValueCandidates
impl Unpin for ArgValueCandidates
impl !UnwindSafe for ArgValueCandidates
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