-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Easily convert typed paths into URIs #790
Conversation
`#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for easily converting paths into URIs for use with `Redirect` and friends. Fixes #789
9e1bca3
to
e4e8990
Compare
The I test it on my machine. When I use But Here is
|
@zys864 thanks for looking into it! I did think the test failure seemed odd but forgot that a new rust came out yesterday. I'm gonna make a separate PR to fix that in a few hours (have meetings), or you're free to do it if you have the time. |
Hm I just thought that this actually is a breaking change. Someone could have implemented |
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.
Should the conversion really be fallible? With parameters being url-encoded, the only case where I could see it failing to convert is if the route itself is invalid (in which case registering it would fail too).
Ah yes that's true, doesn't need to be fallible! |
@jplatte I've added a |
I like it! Changelog / docs still reference |
* Easily convert typed paths into URIs `#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for easily converting paths into URIs for use with `Redirect` and friends. Fixes #789 * Use a method on the `TypedPath` trait to convert to `Uri` * fix doc ref * Update changelogs
These accidentally weren't removed in #790
These accidentally weren't removed in #790
* axum-macros: use fully qualified Result type (#796) * Easily convert typed paths into URIs (#790) * Easily convert typed paths into URIs `#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for easily converting paths into URIs for use with `Redirect` and friends. Fixes #789 * Use a method on the `TypedPath` trait to convert to `Uri` * fix doc ref * Update changelogs * Remove out of date docs These accidentally weren't removed in #790 Co-authored-by: Matthias Vogelgesang <matthias.vogelgesang@gmail.com>
#[derive(TypedPath)]
will now also generateTryFrom<_> for Uri
foreasily converting paths into URIs for use with
Redirect
and friends.Fixes #789