From 6edfe1d39b3be43855714e5f5b726304185ea341 Mon Sep 17 00:00:00 2001 From: Sieluna Date: Tue, 15 Jul 2025 00:59:08 +0300 Subject: [PATCH] Link `ComponentIdFor` in the `ComponentId` related docs (#20127) # Objective Fixes https://github.com/bevyengine/bevy/issues/19535. Improve interoperability of type documentation to make it easier for users to find related types ## Solution - Add a reference to [`ComponentIdFor`](crate::component::ComponentIdFor) in the `component_id` function documentation in `crates/bevy_ecs/src/world/mod.rs` - Add a reference to [`ComponentIdFor`](super::ComponentIdFor) in the `component_id` function documentation in `crates/bevy_ecs/src/component/info.rs` ## Testing - Verify documentation generation: `cargo doc` - Check the validity of cross-reference links in the documentation - Confirm that the documentation generated by rustdoc can correctly jump to the type definition of `ComponentIdFor` --- crates/bevy_ecs/src/component/info.rs | 1 + crates/bevy_ecs/src/world/mod.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ecs/src/component/info.rs b/crates/bevy_ecs/src/component/info.rs index 5a1bf96e16..3c3059f6be 100644 --- a/crates/bevy_ecs/src/component/info.rs +++ b/crates/bevy_ecs/src/component/info.rs @@ -641,6 +641,7 @@ impl Components { /// /// # See also /// + /// * [`ComponentIdFor`](super::ComponentIdFor) /// * [`Components::get_id()`] /// * [`Components::resource_id()`] /// * [`World::component_id()`](crate::world::World::component_id) diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index e77b348c96..57380b489b 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -602,6 +602,7 @@ impl World { /// /// # See also /// + /// * [`ComponentIdFor`](crate::component::ComponentIdFor) /// * [`Components::component_id()`] /// * [`Components::get_id()`] #[inline] @@ -704,7 +705,7 @@ impl World { /// } /// ``` /// - /// ## [`EntityHashSet`](crate::entity::EntityHashMap) + /// ## [`EntityHashSet`](crate::entity::EntityHashSet) /// /// ``` /// # use bevy_ecs::{prelude::*, entity::EntityHashSet}; @@ -838,7 +839,7 @@ impl World { /// } /// ``` /// - /// ## [`EntityHashSet`](crate::entity::EntityHashMap) + /// ## [`EntityHashSet`](crate::entity::EntityHashSet) /// /// ``` /// # use bevy_ecs::{prelude::*, entity::EntityHashSet};