Skip to content
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.

clap_derive: support fixed arrays as shortcut for number_of_values = N #137

Open
epage opened this issue Dec 6, 2021 · 3 comments
Open

Comments

@epage
Copy link
Owner

epage commented Dec 6, 2021

Issue by CreepySkeleton
Sunday Feb 09, 2020 at 15:03 GMT
Originally opened as clap-rs/clap#1682


Transferred from: TeXitoi/structopt#349

It would be even better if fixed sized arrays or tuples with different value types would be supported directly:

#[derive(Clap)]
struct Args {
    #[clap(long)]
    range: [u32; N], // implies `required = true` and `number_of_values = N` 

    #[clap(long)]
    range: Option<[u32; N]>, // `number_of_values = N` 
}
@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by pksunkara
Monday Mar 02, 2020 at 17:22 GMT


Could you create a separate issue for the tuples?

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by cecton
Thursday Mar 26, 2020 at 15:29 GMT


Yeah actually having something automatic for tuples would solve my issue as I won't have to fight with Vec. (But I still believe the current impl of Vec is wrong but I didn't read your answer yet.)

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by CreepySkeleton
Saturday Apr 18, 2020 at 13:30 GMT


This change would be breaking if implemented after 3.0 is out, so triaging for 3.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant