mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-06 00:00:17 +02:00
Apply suggestions from code review
Co-authored-by: Jonas Platte <[email protected]>
This commit is contained in:
co-authored by
Jonas Platte
parent
8ddf49501f
commit
fcf8796b4b
@@ -64,7 +64,7 @@ use super::sealed::Sealed;
|
|||||||
///
|
///
|
||||||
/// # Using `#[derive(TypedPath)]`
|
/// # Using `#[derive(TypedPath)]`
|
||||||
///
|
///
|
||||||
/// While `TypedPath` can be implemented manually its _highly_ recommended to derive it:
|
/// While `TypedPath` can be implemented manually, it's _highly_ recommended to derive it:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use serde::Deserialize;
|
/// use serde::Deserialize;
|
||||||
@@ -84,7 +84,7 @@ use super::sealed::Sealed;
|
|||||||
/// things, create links to known paths and have them verified statically.
|
/// 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 its a unit struct.
|
/// also implement [`serde::Deserialize`], unless it's a unit struct.
|
||||||
///
|
///
|
||||||
/// 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:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub(crate) fn expand(item_struct: ItemStruct) -> syn::Result<TokenStream> {
|
|||||||
if !generics.params.is_empty() || generics.where_clause.is_some() {
|
if !generics.params.is_empty() || generics.where_clause.is_some() {
|
||||||
return Err(syn::Error::new_spanned(
|
return Err(syn::Error::new_spanned(
|
||||||
generics,
|
generics,
|
||||||
"`#[derive(TypePath)]` doesn't support generics",
|
"`#[derive(TypedPath)]` doesn't support generics",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user