mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 06:00:20 +00:00
Interpolate WorldQuery
path in docs of generated types (#14985)
# Objective Fixes #14972 ## Solution Uses the `concat!` macro to interpolate the `path` variable. ## Testing * Run `cargo doc --workspace --open` * Check functionality of `WorldQuery` links within `NodeQueryItem`, `NodeQueryReadOnly`, `NodeQueryReadOnlyItem` docs
This commit is contained in:
parent
41474226c3
commit
3a8d5598ad
3 changed files with 38 additions and 18 deletions
|
@ -250,9 +250,13 @@ pub fn derive_query_data_impl(input: TokenStream) -> TokenStream {
|
||||||
user_where_clauses_with_world,
|
user_where_clauses_with_world,
|
||||||
);
|
);
|
||||||
let read_only_structs = quote! {
|
let read_only_structs = quote! {
|
||||||
#[doc = "Automatically generated [`WorldQuery`] type for a read-only variant of [`"]
|
#[doc = concat!(
|
||||||
#[doc = stringify!(#struct_name)]
|
"Automatically generated [`WorldQuery`](",
|
||||||
#[doc = "`]."]
|
stringify!(#path),
|
||||||
|
"::query::WorldQuery) type for a read-only variant of [`",
|
||||||
|
stringify!(#struct_name),
|
||||||
|
"`]."
|
||||||
|
)]
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
#visibility struct #read_only_struct_name #user_impl_generics #user_where_clauses {
|
#visibility struct #read_only_struct_name #user_impl_generics #user_where_clauses {
|
||||||
#(
|
#(
|
||||||
|
@ -331,9 +335,13 @@ pub fn derive_query_data_impl(input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
const _: () = {
|
const _: () = {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[doc = "Automatically generated internal [`WorldQuery`] state type for [`"]
|
#[doc = concat!(
|
||||||
#[doc = stringify!(#struct_name)]
|
"Automatically generated internal [`WorldQuery`](",
|
||||||
#[doc = "`], used for caching."]
|
stringify!(#path),
|
||||||
|
"::query::WorldQuery) state type for [`",
|
||||||
|
stringify!(#struct_name),
|
||||||
|
"`], used for caching."
|
||||||
|
)]
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
#visibility struct #state_struct_name #user_impl_generics #user_where_clauses {
|
#visibility struct #state_struct_name #user_impl_generics #user_where_clauses {
|
||||||
#(#named_field_idents: <#field_types as #path::query::WorldQuery>::State,)*
|
#(#named_field_idents: <#field_types as #path::query::WorldQuery>::State,)*
|
||||||
|
|
|
@ -145,9 +145,13 @@ pub fn derive_query_filter_impl(input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
const _: () = {
|
const _: () = {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[doc = "Automatically generated internal [`WorldQuery`] state type for [`"]
|
#[doc = concat!(
|
||||||
#[doc = stringify!(#struct_name)]
|
"Automatically generated internal [`WorldQuery`](",
|
||||||
#[doc = "`], used for caching."]
|
stringify!(#path),
|
||||||
|
"::query::WorldQuery) state type for [`",
|
||||||
|
stringify!(#struct_name),
|
||||||
|
"`], used for caching."
|
||||||
|
)]
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
#visibility struct #state_struct_name #user_impl_generics #user_where_clauses {
|
#visibility struct #state_struct_name #user_impl_generics #user_where_clauses {
|
||||||
#(#named_field_idents: <#field_types as #path::query::WorldQuery>::State,)*
|
#(#named_field_idents: <#field_types as #path::query::WorldQuery>::State,)*
|
||||||
|
|
|
@ -19,12 +19,16 @@ pub(crate) fn item_struct(
|
||||||
user_ty_generics_with_world: &TypeGenerics,
|
user_ty_generics_with_world: &TypeGenerics,
|
||||||
user_where_clauses_with_world: Option<&WhereClause>,
|
user_where_clauses_with_world: Option<&WhereClause>,
|
||||||
) -> proc_macro2::TokenStream {
|
) -> proc_macro2::TokenStream {
|
||||||
let item_attrs = quote!(
|
let item_attrs = quote! {
|
||||||
#[doc = "Automatically generated [`WorldQuery`](#path::query::WorldQuery) item type for [`"]
|
#[doc = concat!(
|
||||||
#[doc = stringify!(#struct_name)]
|
"Automatically generated [`WorldQuery`](",
|
||||||
#[doc = "`], returned when iterating over query results."]
|
stringify!(#path),
|
||||||
#[automatically_derived]
|
"::query::WorldQuery) item type for [`",
|
||||||
);
|
stringify!(#struct_name),
|
||||||
|
"`], returned when iterating over query results."
|
||||||
|
)]
|
||||||
|
#[automatically_derived]
|
||||||
|
};
|
||||||
|
|
||||||
match fields {
|
match fields {
|
||||||
Fields::Named(_) => quote! {
|
Fields::Named(_) => quote! {
|
||||||
|
@ -69,9 +73,13 @@ pub(crate) fn world_query_impl(
|
||||||
) -> proc_macro2::TokenStream {
|
) -> proc_macro2::TokenStream {
|
||||||
quote! {
|
quote! {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[doc = "Automatically generated internal [`WorldQuery`] fetch type for [`"]
|
#[doc = concat!(
|
||||||
#[doc = stringify!(#struct_name)]
|
"Automatically generated internal [`WorldQuery`](",
|
||||||
#[doc = "`], used to define the world data accessed by this query."]
|
stringify!(#path),
|
||||||
|
"::query::WorldQuery) fetch type for [`",
|
||||||
|
stringify!(#struct_name),
|
||||||
|
"`], used to define the world data accessed by this query."
|
||||||
|
)]
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
#visibility struct #fetch_struct_name #user_impl_generics_with_world #user_where_clauses_with_world {
|
#visibility struct #fetch_struct_name #user_impl_generics_with_world #user_where_clauses_with_world {
|
||||||
#(#named_field_idents: <#field_types as #path::query::WorldQuery>::Fetch<'__w>,)*
|
#(#named_field_idents: <#field_types as #path::query::WorldQuery>::Fetch<'__w>,)*
|
||||||
|
|
Loading…
Reference in a new issue