Skip to content
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

Support Option and Result in typed paths #1001

Merged
merged 4 commits into from
May 6, 2022
Merged

Conversation

davidpdrsn
Copy link
Member

@davidpdrsn davidpdrsn commented May 5, 2022

Fixes #994

Makes this work:

#[derive(TypedPath, Deserialize)]
#[typed_path("/users/:id")]
struct UsersShow {
    id: String,
}

// this previously wouldn't compile when used with `Router::typed_*`
async fn option_handler(_: Option<UsersShow>) {}

async fn result_handler(_: Result<UsersShow, PathRejection>) {}

axum-extra/CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
axum-macros/CHANGELOG.md Outdated Show resolved Hide resolved
@davidpdrsn davidpdrsn requested a review from jplatte May 6, 2022 06:24
@davidpdrsn davidpdrsn merged commit 4ff78e5 into main May 6, 2022
@davidpdrsn davidpdrsn deleted the option-result-typed-path branch May 6, 2022 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make TypedPath support Result and Option
2 participants