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

impl Eq<std::any::TypeId> for clap_builder::util::AnyValueId #4873

Merged
merged 1 commit into from May 2, 2023

Conversation

Molkars
Copy link
Contributor

@Molkars Molkars commented May 1, 2023

Allow equality comparison for AnyValueId and TypeId.

Background:
I am trying to write a schema command for my CLI. I am using the type_id method on the ValueParser to get the data type for an argument but cannot actually compare it to anything without this implementation.

@epage
Copy link
Member

epage commented May 2, 2023

Would it also work to publicly expose of?

@epage epage merged commit a2131ae into clap-rs:master May 2, 2023
20 of 21 checks passed
@Molkars
Copy link
Contributor Author

Molkars commented May 2, 2023

Allowing of would also work although I don't know if you would need developers creating an AnyValueId given that it is only used by the ValueParsers internally.
I don't think it would be a bad idea to implement Deref<Target=std::any::TypeId> for AnyValueId as well. Since AnyValueId is just a wrapper around TypeId, it would be useful to be able to access the inner type.

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.

None yet

2 participants