-
Notifications
You must be signed in to change notification settings - Fork 171
der: remove lifetime from OctetStringRef
#1998
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
Conversation
|
Custom derive needs to be updated to be aware that certain types are reference types and need to be used as e.g. |
8cee1e0 to
2359ca5
Compare
54b1fbb to
2a06eca
Compare
|
Well, with a few hacks this is green. I think the hacks might be OK to merge with, but we'd ideally want to get them removed before a final release. |
OctetStringRefOctetStringRef
| // TODO(tarcieri): custom derive hack until the logic is updated to support `&'a` reference types | ||
| #[doc(hidden)] | ||
| pub type OctetStringRef2<'a> = &'a OctetStringRef; |
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.
This is one of the hacks. I didn't implement special case support for &'a MyRef types in der_derive yet, so this hack lets it use the old syntax.
Following the pattern of #1921, removes the lifetime from the struct, instead changing `OctetStringRef` to a proper reference type to be used as `&OctetStringRef`. This makes it possible to `impl Borrow<OctetStringRef> for OctetString` and `impl ToOwned for OctetStringRef`, so they can work with `Cow`.
2a06eca to
77c4d20
Compare
|
Gonna land this. We can work through custom derive support separately. I'll make an issue about it. Edit: opened #2039 |
Following the pattern of #1921, removes the lifetime from the struct, instead changing
OctetStringRefto a proper reference type to be used as&OctetStringRef.This makes it possible to
impl Borrow<OctetStringRef> for OctetStringandimpl ToOwned for OctetStringRef, so they can work withCow.cc @dishmaker