-
-
Notifications
You must be signed in to change notification settings - Fork 64
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 trait FlattenInto #151
Conversation
Thank you for the PR! I wonder if we can get away without having a dedicated trait for this in rather offer a |
I think the trait is not really necessary, but easy to enforce that the method is implemented correctly everywhere. I updated the PR, and removed the trait. Although I didn't find a proper way to add a |
Given that impl<SrcOctets, Ref> ZoneRecordData<SrcOctets, ParseDname<Ref>>
where
SrcOctets: AsRef<[u8]>,
Ref: OctetsRef,
{
pub fn flatten_into<Octets>(
self,
) -> Result<ZoneRecordData<Octets, crate::base::Dname<Octets>>, PushError>
where
Octets: OctetsFrom<SrcOctets> + FromBuilder,
<Octets as FromBuilder>::Builder: EmptyBuilder,
{
// ...
}
} You can then also provide What would then also be good if the result uses |
I can drop the
Not quit sure about this though, if we'd like to optimize |
A Can we use |
The function converts ParsedDname inside rdata into Dname, with proper octets change. It helps the user from making the boilerplate again on each of the individual types.
I think I get your idea now. PR updated. |
Looking great now! Again, thank you for the PR! |
Hi,
This is a followup for #126, could you please let me know what do you think when you got a moment? Thanks.
The FlattenInto trait can help in case of converting ParsedDname into Dname in nested structure like
Record<N1, ZoneRecordData<O, N2>>
, so the user does not need to enumerate all the rdata types.