add note about Display/Serialize being compatible

This commit is contained in:
David Pedersen
2022-02-14 15:20:26 +01:00
parent fcf8796b4b
commit feb86f6bb3
+4 -2
View File
@@ -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: