-
Notifications
You must be signed in to change notification settings - Fork 73
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
[ENHANCEMENT] Implement From<T> for UrlParts enums #24
Comments
I was thinking the exact same thing when I was reading the docs. Should we go a step further and have Also, what should we do when the variants are the same type? |
👍 to this
As far as I am aware, I think there are only a few APIs where the enum variant to construct from a passed tuple of values is ambiguous
In these cases, I would propose choosing the more common variant? |
Started looking at this in enhancement/24 branch. |
This commit implements From<T> for Url parts enums. Closes #24
This commit implements From<T> for Url parts enums. Closes #24
Each API models the API url parts as an enum, and where an API has more than one enum variant, the API function on the root/namespace client takes the enum as an argument. For example, for search
Currently, the Rust compiler cannot infer the enum type based on the parameter, meaning the complete enum path needs to be specified as above, instead of simply the following pseudo
To make the API somewhat simpler to use, it is proposed to implement
From<T>
traits for each enum such that a value, or tuple of values, can be used. Taking the example aboveThe text was updated successfully, but these errors were encountered: