-
-
Notifications
You must be signed in to change notification settings - Fork 65
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 Composer implementation for reference types #231
Conversation
Could this just be a blanket impl for any mut ref to a composer? The compiler seems to accept that. |
82aaf36
to
b657496
Compare
Even better. The PR has been updated. |
This isn’t quite right – the trait functions should defer to the functions in the referenced type and not use the default impls. In my quick test, I had something like this:
|
b657496
to
96b4f4d
Compare
Sorry, to be annoying, but the same should be done for |
The use case is to share the underlying Composer buffer between builders to avoid allocation, via a thread local variable for example. Without the reference type implements, the ownership could be transferred by memory swap operation, but that's not quite ideal. Plus some methods like MessageBuilder::from_target would drop the Composer on error, which makes it even difficult to share.
96b4f4d
to
3701695
Compare
My bad, I got up early this morning, with my brain left behind. Thought the |
Looking good now; thank you for the PR! |
Breaking changes * Move the `flatten_into` method for converting domain names into a straight, flat form into a new `FlattenInto` trait. This trait is only implemented for types that actually are or contain domain names. ([#216]) * Marked various methods and functions that return values without side effects as `#[must_use]`. ([#228] by [@WhyNotHugo]) * Changed the signature of `FoundSrvs::merge` to use a non-mut `other`. ([#232]) New * Added support for the ZONEMD record type. ([#229] by [@xofyarg]) * Re-exported the _octseq_ crate as `dep::octseq`. ([#230]) * Added a blanket impl for mut refs to `Composer`. ([#231] by [@xofyarg])
The use case is to share the underlying Composer buffer between builders to avoid allocation, via a thread local variable for example. Without the reference type implements, the ownership could be transferred by memory swap operation, but that's not quite ideal. Plus some methods like MessageBuilder::from_target would drop the Composer on error, which makes it even difficult to share.