-
Notifications
You must be signed in to change notification settings - Fork 121
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 AlgorithmIdentifier::oids() helper function #443
Conversation
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
match self.parameters { | ||
None => None, | ||
Some(p) => match p { | ||
Any::NULL => None, | ||
_ => Some(p.oid()?), | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match self.parameters { | |
None => None, | |
Some(p) => match p { | |
Any::NULL => None, | |
_ => Some(p.oid()?), | |
}, | |
}, | |
self.parameters.and_then(|p| match p { | |
Any::NULL => None, | |
_ => Some(p.oid()?), | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarcieri This actually doesn't compile because it embeds the error handling in the function. I think my version is actually cleaner due to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit.
I'd be curious to see a use case for this. There are a lot of helper methods like this already.
@tarcieri It makes it easy to do things like compare key algorithms with signature algorithms. See: https://github.com/profianinc/steward/blob/main/src/signed.rs#L169-L170 |
Signed-off-by: Nathaniel McCallum nathaniel@profian.com