From feb86f6bb367f5640d7961ef057f3993fde2a735 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 14 Feb 2022 15:20:26 +0100 Subject: [PATCH] add note about Display/Serialize being compatible --- axum-extra/src/routing/typed.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/axum-extra/src/routing/typed.rs b/axum-extra/src/routing/typed.rs index 81d980d3..714f02a3 100644 --- a/axum-extra/src/routing/typed.rs +++ b/axum-extra/src/routing/typed.rs @@ -80,11 +80,13 @@ use super::sealed::Sealed; /// The macro expands to: /// /// - A `TypedPath` implementation. -/// - A [`Display`] implementation that interpolates the captures. This can be used to, among other -/// things, create links to known paths and have them verified statically. /// - A [`FromRequest`] implementation compatible with [`RouterExt::typed_get`], /// [`RouterExt::typed_post`], etc. This implementation uses [`Path`] and thus your struct must /// also implement [`serde::Deserialize`], unless it's a unit struct. +/// - A [`Display`] implementation that interpolates the captures. This can be used to, among other +/// things, create links to known paths and have them verified statically. Note that the +/// [`Display`] implementation for each field must return something that's compatible with it's +/// [`Deserialize`] implementation. /// /// Additionally the macro will verify the captures in the path matches the fields of the struct. /// For example this fails to compile since the struct doesn't have a `team_id` field: