Skip to content

Commit 34d5714

Browse files
Fix docstring type references
1 parent 5c4d486 commit 34d5714

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

crates/bevy_ecs/src/world/archetype_invariants.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use bevy_utils::{tracing::warn, HashSet};
44

55
use crate::{component::ComponentId, prelude::Bundle, world::World};
66

7-
/// A rule about which [`Component`]s can coexist on entities
7+
/// A rule about which [`Component`](crate::component::Component)s can coexist on entities
88
///
99
/// These rules must be true at all times for all entities in the [`World`].
1010
/// The generic [`Bundle`] type `B1` is always used in the `predicate`,
@@ -13,7 +13,7 @@ use crate::{component::ComponentId, prelude::Bundle, world::World};
1313
///
1414
/// When added to the [`World`], archetype invariants behave like [`assert!`];
1515
/// all archetype invariants must be true for every entity in the [`World`].
16-
/// Archetype invariants are checked each time [`Archetypes`] is modified;
16+
/// Archetype invariants are checked each time [`Archetypes`](crate::archetype::Archetypes) is modified;
1717
/// this can occur on component addition, component removal, and entity spawning.
1818
///
1919
/// Archetypes are only modified when a novel archetype (set of components) is seen for the first time;
@@ -66,7 +66,7 @@ impl<B: Bundle> ArchetypeInvariant<B, B> {
6666
/// For single component bundles, `AllOf` and `AtLeastOneOf` are equivalent.
6767
/// Prefer `ArchetypeStatement::<(C,)>::all_of` over `ArchetypeStatement::<(C,)>::at_least_one_of` for consistency and clarity.
6868
///
69-
/// Note that this is converted to an [`UntypedArchetypeStatment`] when added to a [`World`].
69+
/// Note that this is converted to an [`UntypedArchetypeStatement`] when added to a [`World`].
7070
/// This is to ensure compatibility between different invariants.
7171
#[derive(Clone, Debug, PartialEq)]
7272
pub enum ArchetypeStatement<B: Bundle> {
@@ -75,7 +75,7 @@ pub enum ArchetypeStatement<B: Bundle> {
7575
/// The entity has at least one component in the bundle `B`, and may have all of them.
7676
/// When using a single-component bundle, `AllOf` is preferred.
7777
AtLeastOneOf(PhantomData<B>),
78-
/// The entity has zero or one of the components in the bundle `B`, and may have all of them.
78+
/// The entity has zero or one of the components in the bundle `B`, but no more.
7979
/// When using a single-component bundle, this is a tautology.
8080
AtMostOneOf(PhantomData<B>),
8181
/// The entity has none of the components in the bundle `B`
@@ -145,7 +145,7 @@ pub struct UntypedArchetypeInvariant {
145145
impl UntypedArchetypeInvariant {
146146
/// Assert that the provided iterator of [`ComponentId`]s obeys this archetype invariant
147147
///
148-
/// `component_ids` is generally provided via the `components` field on [`Archetype`].
148+
/// `component_ids` is generally provided via the `components` field on [`Archetype`](crate::archetype::Archetype).
149149
/// When testing against multiple archetypes, [`ArchetypeInvariants::test_archetype`] is preferred,
150150
/// as it can more efficiently cache checks between archetypes.
151151
///
@@ -165,17 +165,17 @@ impl UntypedArchetypeInvariant {
165165
}
166166
}
167167

168-
/// A type-erased version of [`ArchetypeStatment`]
168+
/// A type-erased version of [`ArchetypeStatement`]
169169
/// Intended to be used with dynamic components that cannot be represented with Rust types.
170-
/// Prefer [`ArchetypeStatment`] when possible.
170+
/// Prefer [`ArchetypeStatement`] when possible.
171171
#[derive(Clone, Debug, PartialEq)]
172172
pub enum UntypedArchetypeStatement {
173173
/// Evaluates to true if and only if the entity has all of the components present in the set
174174
AllOf(HashSet<ComponentId>),
175175
/// The entity has at least one component in the set, and may have all of them.
176176
/// When using a single-component set, `AllOf` is preferred
177177
AtLeastOneOf(HashSet<ComponentId>),
178-
/// The entity has zero or one of the components in the set, and may have all of them.
178+
/// The entity has zero or one of the components in the set, but no more.
179179
/// When using a single-component set, this is a tautology.
180180
AtMostOneOf(HashSet<ComponentId>),
181181
/// The entity has none of the components in the set
@@ -254,14 +254,11 @@ impl ArchetypeInvariants {
254254

255255
/// Assert that the provided iterator of [`ComponentId`]s obeys all archetype invariants
256256
///
257-
/// `component_ids` is generally provided via the `components` field on [`Archetype`].
257+
/// `component_ids` is generally provided via the `components` field on [`Archetype`](crate::archetype::Archetype).
258258
///
259259
/// # Panics
260260
/// Panics if any archetype invariant is violated
261-
pub(crate) fn test_archetype(
262-
&self,
263-
component_ids_of_archetype: impl Iterator<Item = ComponentId>,
264-
) {
261+
pub fn test_archetype(&self, component_ids_of_archetype: impl Iterator<Item = ComponentId>) {
265262
let component_ids_of_archetype: HashSet<ComponentId> = component_ids_of_archetype.collect();
266263

267264
for invariant in &self.raw_list {

crates/bevy_ecs/src/world/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ impl World {
676676
///
677677
/// Whenever a new archetype invariant is added, all existing archetypes are re-checked.
678678
/// This may include empty archetypes- archetypes that contain no entities.
679-
/// Prefer [`add_archetype_invariant`](World::add_archertype_invariant) where possible.
679+
/// Prefer [`add_archetype_invariant`](World::add_archetype_invariant) where possible.
680680
#[inline]
681681
pub fn add_untyped_archetype_invariant(
682682
&mut self,

0 commit comments

Comments
 (0)