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

feat: add new NewType derive #450

Merged
merged 1 commit into from
Feb 27, 2022
Merged

Conversation

npmccallum
Copy link
Contributor

There are a number of der types that could benefit from wrapping in a
newtype. For example, RelativeDistinguishedName could benefit from
an impl Display to convert it to a string representation. But because
it is just Vec<AttributeTypeAndValue> we can't really do this.

Having a systematic way to derive newtypes in these cases is thus
beneficial.

Signed-off-by: Nathaniel McCallum nathaniel@profian.com

@npmccallum
Copy link
Contributor Author

@tarcieri Let me know if you like this approach or not. I have a bunch of types it could apply to. Particularly, x509 extensions.

@tarcieri
Copy link
Member

Hmmm, interesting. It kind of makes sense. Let me think about it a bit more.

@npmccallum
Copy link
Contributor Author

npmccallum commented Feb 26, 2022

FYI, I intend to combine this PR with the #451 and implement #417. So don't take too long thinking about it. ;)

@tarcieri
Copy link
Member

I guess this is fine. My only remaining concern is that "newtype" is pretty much exclusively used as a closed compound word, in which case the proper Rust capitalization is "Newtype"

There are a number of der types that could benefit from wrapping in a
newtype. For example, `RelativeDistinguishedName` could benefit from
an `impl Display` to convert it to a string representation. But because
it is just `Vec<AttributeTypeAndValue>` we can't really do this.

Having a systematic way to derive newtypes in these cases is thus
beneficial.

Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
@npmccallum
Copy link
Contributor Author

@tarcieri I have renamed NewType => Newtype and new_type => newtype.

@tarcieri tarcieri merged commit 389372d into RustCrypto:master Feb 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.

None yet

2 participants