mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
add note about Display/Serialize being compatible
This commit is contained in:
@@ -80,11 +80,13 @@ use super::sealed::Sealed;
|
|||||||
/// The macro expands to:
|
/// The macro expands to:
|
||||||
///
|
///
|
||||||
/// - A `TypedPath` implementation.
|
/// - 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`],
|
/// - A [`FromRequest`] implementation compatible with [`RouterExt::typed_get`],
|
||||||
/// [`RouterExt::typed_post`], etc. This implementation uses [`Path`] and thus your struct must
|
/// [`RouterExt::typed_post`], etc. This implementation uses [`Path`] and thus your struct must
|
||||||
/// also implement [`serde::Deserialize`], unless it's a unit struct.
|
/// 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.
|
/// 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:
|
/// For example this fails to compile since the struct doesn't have a `team_id` field:
|
||||||
|
|||||||
Reference in New Issue
Block a user