-
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
Implement into Uri for TypedPath #789
Labels
Comments
davidpdrsn
added
A-axum-macros
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
labels
Feb 24, 2022
Good call! I think we should implement |
davidpdrsn
added a commit
that referenced
this issue
Feb 24, 2022
`#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for easily converting paths into URIs for use with `Redirect` and friends. Fixes #789
davidpdrsn
added a commit
that referenced
this issue
Feb 24, 2022
`#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for easily converting paths into URIs for use with `Redirect` and friends. Fixes #789
davidpdrsn
added a commit
that referenced
this issue
Feb 28, 2022
* 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
davidpdrsn
added a commit
that referenced
this issue
Mar 1, 2022
* 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
davidpdrsn
added a commit
that referenced
this issue
Mar 1, 2022
* 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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature Request
Add ergonomic improvements to
TypedPath
Motivation
It feels so off to write
Redirect::temporary(MyPath.to_string().parse().unwrap())
instead ofRedirect::temporary(MyPath.into_uri())
.Proposal
Add and implement a new trait
IntoUri
toTypedPath
.Alternatives
Maybe
Into<Uri>
works also just fine, the only open question is if/how can fail to generate theUri
.The text was updated successfully, but these errors were encountered: