-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Allow to use owned types on requests #595
Comments
Thanks for opening this - agreed it would be much more user friendly. I think the related question is if you'd want to keep the borrowed option with The latter would make The other minor concern to check for would be impact on compile times - one advantage of purely borrowed types is minimal generated code for |
I mentioned I'll try to familiarize with the codegen crate to check if I can make some PR, but I'm not sure if I will get familiar enough to implement that refactor. |
I will close this since it has landed in next and we don't plan on backporting. |
Is your feature request related to a problem? Please describe.
I'm using
next
branch.When building requests, for example
CreateWebhookEndpoint
, we must pass a reference to the fields in order to construct them.This is inconvenient for two reasons:
We can't implement
From
other types we own to the requests or build the requests in any isolated method, because we can't return values referenced by the function and we can't transfer the ownership. Pseudo-code example:We can't build the values only when required, because borrowed value does not live long enough. Pseudo-code example:
Describe the solution you'd like
Update the signature of the methods to require
impl Into<Cow<'a, {type}>>
and the Builders properties to haveCow<'a, {type}>
instead of&'a {type}
, allowing both previous scenario and the ones defined above.For example this method:
Would allow both ways:
Describe alternatives you've considered
There's no alternative other than avoiding those scenarios.
Additional context
No response
The text was updated successfully, but these errors were encountered: