Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: added more common derives App, Arg, and ArgMatches #2266

Merged
merged 1 commit into from
Dec 26, 2020

Conversation

budde25
Copy link
Contributor

@budde25 budde25 commented Dec 23, 2020

Closes #952

This is the current status (after the changes) of the the public types.

  • App

    • Clone
    • Eq
    • PartialEq
    • Ord
    • PartialOrd
    • Hash
    • Debug,
    • Display
    • Default
  • Arg

    • Clone
    • Eq
    • PartialEq
    • Ord
    • PartialOrd
    • Hash
    • Debug,
    • Display
    • Default
  • ArgMatches

    • Clone
    • Eq
    • PartialEq
    • Ord
    • PartialOrd
    • Hash
    • Debug,
    • Display
    • Default
  • Values

    • Copy
    • Clone
    • Eq
    • PartialEq
    • Ord
    • PartialOrd
    • Hash
    • Debug,
    • Display
    • Default
  • ValuesOs

    • Copy
    • Clone
    • Eq
    • PartialEq
    • Ord
    • PartialOrd
    • Hash
    • Debug,
    • Display
    • Default

The only types that I was able to add were Eq, and PartialEq.
I also noticed that for Values and ValuesOs, it explicitly said that it didn't implement debug so I'm unsure if that is a design choice.

Regarding certain traits:

  • Default is meaningless for Arg, App, ArgGroup.
  • Implementing PartialOrd + Ord is probably next to impossible because they aren't implemented for IndexMap. Same with Hash

Originally posted by @CreepySkeleton in #952 (comment)

The three mentioned here already had explicit default implementations.

It also may be possible to add things like Eq, and PartialEq to Values and ValuesOs but it isn't possible as far as I can tell with default derive implementation. It seems to mostly be a limitation of std::slice::Iter

@pksunkara pksunkara merged commit 7728000 into clap-rs:master Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement and Derive common traits
2 participants