Skip to content

Commit 71c5e27

Browse files
committed
fix(complete)!: Rename CustomCompleter to ValueCandidates
1 parent 1089073 commit 71c5e27

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

clap_complete/src/engine/custom.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clap::builder::ArgExt;
55

66
use super::CompletionCandidate;
77

8-
/// Extend [`Arg`][clap::Arg] with a [`CustomCompleter`]
8+
/// Extend [`Arg`][clap::Arg] with a [`ValueCandidates`]
99
///
1010
/// # Example
1111
///
@@ -23,13 +23,13 @@ use super::CompletionCandidate;
2323
/// }
2424
/// ```
2525
#[derive(Clone)]
26-
pub struct ArgValueCompleter(Arc<dyn CustomCompleter>);
26+
pub struct ArgValueCompleter(Arc<dyn ValueCandidates>);
2727

2828
impl ArgValueCompleter {
2929
/// Create a new `ArgValueCompleter` with a custom completer
3030
pub fn new<C>(completer: C) -> Self
3131
where
32-
C: CustomCompleter + 'static,
32+
C: ValueCandidates + 'static,
3333
{
3434
Self(Arc::new(completer))
3535
}
@@ -53,14 +53,14 @@ impl ArgExt for ArgValueCompleter {}
5353
/// User-provided completion candidates for an [`Arg`][clap::Arg], see [`ArgValueCompleter`]
5454
///
5555
/// This is useful when predefined value hints are not enough.
56-
pub trait CustomCompleter: Send + Sync {
56+
pub trait ValueCandidates: Send + Sync {
5757
/// All potential candidates for an argument.
5858
///
5959
/// See [`CompletionCandidate`] for more information.
6060
fn candidates(&self) -> Vec<CompletionCandidate>;
6161
}
6262

63-
impl<F> CustomCompleter for F
63+
impl<F> ValueCandidates for F
6464
where
6565
F: Fn() -> Vec<CompletionCandidate> + Send + Sync,
6666
{

clap_complete/src/engine/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ mod custom;
99
pub use candidate::CompletionCandidate;
1010
pub use complete::complete;
1111
pub use custom::ArgValueCompleter;
12-
pub use custom::CustomCompleter;
12+
pub use custom::ValueCandidates;

clap_complete/tests/testsuite/engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fs;
44
use std::path::Path;
55

66
use clap::{builder::PossibleValue, Command};
7-
use clap_complete::engine::{ArgValueCompleter, CompletionCandidate, CustomCompleter};
7+
use clap_complete::engine::{ArgValueCompleter, CompletionCandidate, ValueCandidates};
88
use snapbox::assert_data_eq;
99

1010
macro_rules! complete {
@@ -596,7 +596,7 @@ fn suggest_custom_arg_value() {
596596
#[derive(Debug)]
597597
struct MyCustomCompleter {}
598598

599-
impl CustomCompleter for MyCustomCompleter {
599+
impl ValueCandidates for MyCustomCompleter {
600600
fn candidates(&self) -> Vec<CompletionCandidate> {
601601
vec![
602602
CompletionCandidate::new("custom1"),

0 commit comments

Comments
 (0)