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

Add support for std::net::Ipv6Addr type #38

Merged
merged 2 commits into from
Jan 27, 2022
Merged

Add support for std::net::Ipv6Addr type #38

merged 2 commits into from
Jan 27, 2022

Conversation

rcgoodfellow
Copy link
Contributor

IPv6 Address Support

This PR adds support for "ipv6" -> std::net::Ipv6Addr.

I've tested these changes in support of this schema and the generated client is working as expected.

Rust compiler issue

I ran into an issue with the generated code that produced this error.

error[E0004]: non-exhaustive patterns: type `&Null` is non-empty
  --> ddm-admin-client/src/lib.rs:1:1
   |
1  | / progenitor::generate_api!(
2  | |     spec = "../ddm/openapi/ddm-admin.json",
3  | |     inner_type = slog::Logger,
4  | |     pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
...  |
13 | |     }),
14 | | );
   | |_^ `Null` defined here
   |
   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   = note: the matched value is of type `&Null`
   = note: references are always considered inhabited
   = note: this error originates in the macro `progenitor::generate_api` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0004`.
error: could not compile `ddm-admin-client` due to previous error

I traced this down to the self dereference in the attached diff. For more details see this issue. I hit this on nightly-2021-11-24 using the 2021 edition.

Also fix non-exhaustive patterns issue.
@rcgoodfellow rcgoodfellow requested a review from ahl January 27, 2022 04:22
Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for adding this and thanks for chasing down the mysterious non-exhaustive match issue.

@rcgoodfellow rcgoodfellow merged commit b712fe6 into main Jan 27, 2022
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.

2 participants