mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Improve doc formatting. (#9840)
# Objective - Identifiers in docs should be marked up with backticks. ## Solution - Mark up more identifiers in the docs with backticks.
This commit is contained in:
parent
359e6c718d
commit
5e91e5f3ce
13 changed files with 60 additions and 59 deletions
|
@ -55,7 +55,7 @@ pub struct Fxaa {
|
|||
|
||||
/// Use lower sensitivity for a sharper, faster, result.
|
||||
/// Use higher sensitivity for a slower, smoother, result.
|
||||
/// [Ultra](`Sensitivity::Ultra`) and [Extreme](`Sensitivity::Extreme`)
|
||||
/// [`Ultra`](`Sensitivity::Ultra`) and [`Extreme`](`Sensitivity::Extreme`)
|
||||
/// settings can result in significant smearing and loss of detail.
|
||||
|
||||
/// The minimum amount of local contrast required to apply algorithm.
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::{borrow::Cow, collections::VecDeque};
|
|||
|
||||
use crate::MAX_DIAGNOSTIC_NAME_WIDTH;
|
||||
|
||||
/// Unique identifier for a [Diagnostic]
|
||||
/// Unique identifier for a [`Diagnostic`].
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)]
|
||||
pub struct DiagnosticId(pub Uuid);
|
||||
|
||||
|
@ -22,7 +22,7 @@ impl Default for DiagnosticId {
|
|||
}
|
||||
}
|
||||
|
||||
/// A single measurement of a [Diagnostic]
|
||||
/// A single measurement of a [`Diagnostic`].
|
||||
#[derive(Debug)]
|
||||
pub struct DiagnosticMeasurement {
|
||||
pub time: Instant,
|
||||
|
@ -195,7 +195,7 @@ impl Diagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
/// A collection of [Diagnostic]s
|
||||
/// A collection of [`Diagnostic`]s.
|
||||
#[derive(Debug, Default, Resource)]
|
||||
pub struct DiagnosticsStore {
|
||||
// This uses a [`StableHashMap`] to ensure that the iteration order is deterministic between
|
||||
|
|
|
@ -209,7 +209,7 @@ fn insert_reflect(
|
|||
pub struct InsertReflect {
|
||||
/// The entity on which the component will be inserted.
|
||||
pub entity: Entity,
|
||||
/// The reflect [Component](crate::component::Component) that will be added to the entity.
|
||||
/// The reflect [`Component`](crate::component::Component) that will be added to the entity.
|
||||
pub component: Box<dyn Reflect>,
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ pub struct InsertReflectWithRegistry<T: Resource + AsRef<TypeRegistry>> {
|
|||
/// The entity on which the component will be inserted.
|
||||
pub entity: Entity,
|
||||
pub _t: PhantomData<T>,
|
||||
/// The reflect [Component](crate::component::Component) that will be added to the entity.
|
||||
/// The reflect [`Component`](crate::component::Component) that will be added to the entity.
|
||||
pub component: Box<dyn Reflect>,
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ fn remove_reflect(
|
|||
pub struct RemoveReflect {
|
||||
/// The entity from which the component will be removed.
|
||||
pub entity: Entity,
|
||||
/// The [Component](crate::component::Component) type name that will be used to remove a component
|
||||
/// The [`Component`](crate::component::Component) type name that will be used to remove a component
|
||||
/// of the same type from the entity.
|
||||
pub component_type_name: Cow<'static, str>,
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ pub struct RemoveReflectWithRegistry<T: Resource + AsRef<TypeRegistry>> {
|
|||
/// The entity from which the component will be removed.
|
||||
pub entity: Entity,
|
||||
pub _t: PhantomData<T>,
|
||||
/// The [Component](crate::component::Component) type name that will be used to remove a component
|
||||
/// The [`Component`](crate::component::Component) type name that will be used to remove a component
|
||||
/// of the same type from the entity.
|
||||
pub component_type_name: Cow<'static, str>,
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ pub use resource::*;
|
|||
pub use sparse_set::*;
|
||||
pub use table::*;
|
||||
|
||||
/// The raw data stores of a [World](crate::world::World)
|
||||
/// The raw data stores of a [`World`](crate::world::World)
|
||||
#[derive(Default)]
|
||||
pub struct Storages {
|
||||
/// Backing storage for [`SparseSet`] components.
|
||||
|
|
|
@ -111,7 +111,7 @@ impl<I: SparseSetIndex, V> SparseArray<I, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A sparse data structure of [Components](crate::component::Component)
|
||||
/// A sparse data structure of [`Component`](crate::component::Component)s.
|
||||
///
|
||||
/// Designed for relatively fast insertions and deletions.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -42,9 +42,9 @@ use self::unsafe_world_cell::{UnsafeEntityCell, UnsafeWorldCell};
|
|||
/// Stores and exposes operations on [entities](Entity), [components](Component), resources,
|
||||
/// and their associated metadata.
|
||||
///
|
||||
/// Each [Entity] has a set of components. Each component can have up to one instance of each
|
||||
/// Each [`Entity`] has a set of components. Each component can have up to one instance of each
|
||||
/// component type. Entity components can be created, updated, removed, and queried using a given
|
||||
/// [World].
|
||||
/// [`World`].
|
||||
///
|
||||
/// For complex access patterns involving [`SystemParam`](crate::system::SystemParam),
|
||||
/// consider using [`SystemState`](crate::system::SystemState).
|
||||
|
@ -94,7 +94,8 @@ impl Default for World {
|
|||
}
|
||||
|
||||
impl World {
|
||||
/// Creates a new empty [World]
|
||||
/// Creates a new empty [`World`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If [`usize::MAX`] [`World`]s have been created.
|
||||
|
@ -123,13 +124,13 @@ impl World {
|
|||
UnsafeWorldCell::new_readonly(self)
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Entities] collection
|
||||
/// Retrieves this world's [`Entities`] collection.
|
||||
#[inline]
|
||||
pub fn entities(&self) -> &Entities {
|
||||
&self.entities
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Entities] collection mutably
|
||||
/// Retrieves this world's [`Entities`] collection mutably.
|
||||
///
|
||||
/// # Safety
|
||||
/// Mutable reference must not be used to put the [`Entities`] data
|
||||
|
@ -139,25 +140,25 @@ impl World {
|
|||
&mut self.entities
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Archetypes] collection
|
||||
/// Retrieves this world's [`Archetypes`] collection.
|
||||
#[inline]
|
||||
pub fn archetypes(&self) -> &Archetypes {
|
||||
&self.archetypes
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Components] collection
|
||||
/// Retrieves this world's [`Components`] collection.
|
||||
#[inline]
|
||||
pub fn components(&self) -> &Components {
|
||||
&self.components
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Storages] collection
|
||||
/// Retrieves this world's [`Storages`] collection.
|
||||
#[inline]
|
||||
pub fn storages(&self) -> &Storages {
|
||||
&self.storages
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Bundles] collection
|
||||
/// Retrieves this world's [`Bundles`] collection.
|
||||
#[inline]
|
||||
pub fn bundles(&self) -> &Bundles {
|
||||
&self.bundles
|
||||
|
@ -767,10 +768,10 @@ impl World {
|
|||
EntityWorldMut::new(self, entity, location)
|
||||
}
|
||||
|
||||
/// Spawns a batch of entities with the same component [Bundle] type. Takes a given [Bundle]
|
||||
/// iterator and returns a corresponding [Entity] iterator.
|
||||
/// Spawns a batch of entities with the same component [`Bundle`] type. Takes a given
|
||||
/// [`Bundle`] iterator and returns a corresponding [`Entity`] iterator.
|
||||
/// This is more efficient than spawning entities and adding components to them individually,
|
||||
/// but it is limited to spawning entities with the same [Bundle] type, whereas spawning
|
||||
/// but it is limited to spawning entities with the same [`Bundle`] type, whereas spawning
|
||||
/// individually is more flexible.
|
||||
///
|
||||
/// ```
|
||||
|
@ -797,8 +798,8 @@ impl World {
|
|||
SpawnBatchIter::new(self, iter.into_iter())
|
||||
}
|
||||
|
||||
/// Retrieves a reference to the given `entity`'s [Component] of the given type.
|
||||
/// Returns [None] if the `entity` does not have a [Component] of the given type.
|
||||
/// Retrieves a reference to the given `entity`'s [`Component`] of the given type.
|
||||
/// Returns `None` if the `entity` does not have a [`Component`] of the given type.
|
||||
/// ```
|
||||
/// use bevy_ecs::{component::Component, world::World};
|
||||
///
|
||||
|
@ -818,8 +819,8 @@ impl World {
|
|||
self.get_entity(entity)?.get()
|
||||
}
|
||||
|
||||
/// Retrieves a mutable reference to the given `entity`'s [Component] of the given type.
|
||||
/// Returns [None] if the `entity` does not have a [Component] of the given type.
|
||||
/// Retrieves a mutable reference to the given `entity`'s [`Component`] of the given type.
|
||||
/// Returns `None` if the `entity` does not have a [`Component`] of the given type.
|
||||
/// ```
|
||||
/// use bevy_ecs::{component::Component, world::World};
|
||||
///
|
||||
|
@ -844,7 +845,7 @@ impl World {
|
|||
}
|
||||
|
||||
/// Despawns the given `entity`, if it exists. This will also remove all of the entity's
|
||||
/// [Component]s. Returns `true` if the `entity` is successfully despawned and `false` if
|
||||
/// [`Component`]s. Returns `true` if the `entity` is successfully despawned and `false` if
|
||||
/// the `entity` does not exist.
|
||||
/// ```
|
||||
/// use bevy_ecs::{component::Component, world::World};
|
||||
|
@ -952,7 +953,7 @@ impl World {
|
|||
/// To iterate over entities in a deterministic order,
|
||||
/// sort the results of the query using the desired component as a key.
|
||||
/// Note that this requires fetching the whole result set from the query
|
||||
/// and allocation of a [Vec] to store it.
|
||||
/// and allocation of a [`Vec`] to store it.
|
||||
///
|
||||
/// ```
|
||||
/// use bevy_ecs::{component::Component, entity::Entity, world::World};
|
||||
|
@ -1122,7 +1123,7 @@ impl World {
|
|||
});
|
||||
}
|
||||
|
||||
/// Removes the resource of a given type and returns it, if it exists. Otherwise returns [None].
|
||||
/// Removes the resource of a given type and returns it, if it exists. Otherwise returns `None`.
|
||||
#[inline]
|
||||
pub fn remove_resource<R: Resource>(&mut self) -> Option<R> {
|
||||
let component_id = self.components.get_resource_id(TypeId::of::<R>())?;
|
||||
|
@ -1345,7 +1346,7 @@ impl World {
|
|||
}
|
||||
|
||||
/// Gets a reference to the non-send resource of the given type, if it exists.
|
||||
/// Otherwise returns [None].
|
||||
/// Otherwise returns `None`.
|
||||
///
|
||||
/// # Panics
|
||||
/// This function will panic if it isn't called from the same thread that the resource was inserted from.
|
||||
|
@ -1358,7 +1359,7 @@ impl World {
|
|||
}
|
||||
|
||||
/// Gets a mutable reference to the non-send resource of the given type, if it exists.
|
||||
/// Otherwise returns [None]
|
||||
/// Otherwise returns `None`.
|
||||
///
|
||||
/// # Panics
|
||||
/// This function will panic if it isn't called from the same thread that the resource was inserted from.
|
||||
|
@ -1390,12 +1391,12 @@ impl World {
|
|||
Some(resource.id())
|
||||
}
|
||||
|
||||
/// For a given batch of ([Entity], [Bundle]) pairs, either spawns each [Entity] with the given
|
||||
/// bundle (if the entity does not exist), or inserts the [Bundle] (if the entity already exists).
|
||||
/// For a given batch of ([`Entity`], [`Bundle`]) pairs, either spawns each [`Entity`] with the given
|
||||
/// bundle (if the entity does not exist), or inserts the [`Bundle`] (if the entity already exists).
|
||||
/// This is faster than doing equivalent operations one-by-one.
|
||||
/// Returns [Ok] if all entities were successfully inserted into or spawned. Otherwise it returns an [Err]
|
||||
/// Returns `Ok` if all entities were successfully inserted into or spawned. Otherwise it returns an `Err`
|
||||
/// with a list of entities that could not be spawned or inserted into. A "spawn or insert" operation can
|
||||
/// only fail if an [Entity] is passed in with an "invalid generation" that conflicts with an existing [Entity].
|
||||
/// only fail if an [`Entity`] is passed in with an "invalid generation" that conflicts with an existing [`Entity`].
|
||||
///
|
||||
/// # Note
|
||||
/// Spawning a specific `entity` value is rarely the right choice. Most apps should use [`World::spawn_batch`].
|
||||
|
@ -1702,9 +1703,9 @@ impl World {
|
|||
component_id
|
||||
}
|
||||
|
||||
/// Empties queued entities and adds them to the empty [Archetype](crate::archetype::Archetype).
|
||||
/// Empties queued entities and adds them to the empty [`Archetype`](crate::archetype::Archetype).
|
||||
/// This should be called before doing operations that might operate on queued entities,
|
||||
/// such as inserting a [Component].
|
||||
/// such as inserting a [`Component`].
|
||||
pub(crate) fn flush(&mut self) {
|
||||
let empty_archetype = self.archetypes.empty_mut();
|
||||
let table = &mut self.storages.tables[empty_archetype.table_id()];
|
||||
|
@ -1807,7 +1808,7 @@ impl World {
|
|||
|
||||
/// Clears all resources in this [`World`].
|
||||
///
|
||||
/// **Note:** Any resource fetch to this [World] will fail unless they are re-initialized,
|
||||
/// **Note:** Any resource fetch to this [`World`] will fail unless they are re-initialized,
|
||||
/// including engine-internal resources that are only initialized on app/world construction.
|
||||
///
|
||||
/// This can easily cause systems expecting certain resources to immediately start panicking.
|
||||
|
@ -1893,7 +1894,7 @@ impl World {
|
|||
}
|
||||
}
|
||||
|
||||
/// Removes the resource of a given type, if it exists. Otherwise returns [None].
|
||||
/// Removes the resource of a given type, if it exists. Otherwise returns `None`.
|
||||
///
|
||||
/// **You should prefer to use the typed API [`World::remove_resource`] where possible and only
|
||||
/// use this in cases where the actual types are not known at compile time.**
|
||||
|
@ -1905,7 +1906,7 @@ impl World {
|
|||
Some(())
|
||||
}
|
||||
|
||||
/// Removes the resource of a given type, if it exists. Otherwise returns [None].
|
||||
/// Removes the resource of a given type, if it exists. Otherwise returns `None`.
|
||||
///
|
||||
/// **You should prefer to use the typed API [`World::remove_resource`] where possible and only
|
||||
/// use this in cases where the actual types are not known at compile time.**
|
||||
|
@ -1920,8 +1921,8 @@ impl World {
|
|||
Some(())
|
||||
}
|
||||
|
||||
/// Retrieves an immutable untyped reference to the given `entity`'s [Component] of the given [`ComponentId`].
|
||||
/// Returns [None] if the `entity` does not have a [Component] of the given type.
|
||||
/// Retrieves an immutable untyped reference to the given `entity`'s [`Component`] of the given [`ComponentId`].
|
||||
/// Returns `None` if the `entity` does not have a [`Component`] of the given type.
|
||||
///
|
||||
/// **You should prefer to use the typed API [`World::get_mut`] where possible and only
|
||||
/// use this in cases where the actual types are not known at compile time.**
|
||||
|
@ -1940,8 +1941,8 @@ impl World {
|
|||
}
|
||||
}
|
||||
|
||||
/// Retrieves a mutable untyped reference to the given `entity`'s [Component] of the given [`ComponentId`].
|
||||
/// Returns [None] if the `entity` does not have a [Component] of the given type.
|
||||
/// Retrieves a mutable untyped reference to the given `entity`'s [`Component`] of the given [`ComponentId`].
|
||||
/// Returns `None` if the `entity` does not have a [`Component`] of the given type.
|
||||
///
|
||||
/// **You should prefer to use the typed API [`World::get_mut`] where possible and only
|
||||
/// use this in cases where the actual types are not known at compile time.**
|
||||
|
@ -2103,11 +2104,11 @@ unsafe impl Send for World {}
|
|||
unsafe impl Sync for World {}
|
||||
|
||||
/// Creates an instance of the type this trait is implemented for
|
||||
/// using data from the supplied [World].
|
||||
/// using data from the supplied [`World`].
|
||||
///
|
||||
/// This can be helpful for complex initialization or context-aware defaults.
|
||||
pub trait FromWorld {
|
||||
/// Creates `Self` using data from the given [World]
|
||||
/// Creates `Self` using data from the given [`World`].
|
||||
fn from_world(world: &mut World) -> Self;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ impl<'w> UnsafeWorldCell<'w> {
|
|||
unsafe { self.world_metadata() }.id()
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Entities] collection
|
||||
/// Retrieves this world's [`Entities`] collection.
|
||||
#[inline]
|
||||
pub fn entities(self) -> &'w Entities {
|
||||
// SAFETY:
|
||||
|
@ -208,7 +208,7 @@ impl<'w> UnsafeWorldCell<'w> {
|
|||
&unsafe { self.world_metadata() }.entities
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Archetypes] collection
|
||||
/// Retrieves this world's [`Archetypes`] collection.
|
||||
#[inline]
|
||||
pub fn archetypes(self) -> &'w Archetypes {
|
||||
// SAFETY:
|
||||
|
@ -216,7 +216,7 @@ impl<'w> UnsafeWorldCell<'w> {
|
|||
&unsafe { self.world_metadata() }.archetypes
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Components] collection
|
||||
/// Retrieves this world's [`Components`] collection.
|
||||
#[inline]
|
||||
pub fn components(self) -> &'w Components {
|
||||
// SAFETY:
|
||||
|
@ -224,7 +224,7 @@ impl<'w> UnsafeWorldCell<'w> {
|
|||
&unsafe { self.world_metadata() }.components
|
||||
}
|
||||
|
||||
/// Retrieves this world's [Bundles] collection
|
||||
/// Retrieves this world's [`Bundles`] collection.
|
||||
#[inline]
|
||||
pub fn bundles(self) -> &'w Bundles {
|
||||
// SAFETY:
|
||||
|
@ -838,8 +838,8 @@ impl<'w> UnsafeEntityCell<'w> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Retrieves a mutable untyped reference to the given `entity`'s [Component] of the given [`ComponentId`].
|
||||
/// Returns [None] if the `entity` does not have a [Component] of the given type.
|
||||
/// Retrieves a mutable untyped reference to the given `entity`'s [`Component`] of the given [`ComponentId`].
|
||||
/// Returns `None` if the `entity` does not have a [`Component`] of the given type.
|
||||
///
|
||||
/// **You should prefer to use the typed API [`UnsafeEntityCell::get_mut`] where possible and only
|
||||
/// use this in cases where the actual types are not known at compile time.**
|
||||
|
|
|
@ -40,7 +40,7 @@ where
|
|||
///
|
||||
/// If the `input_device`:
|
||||
/// - was present before, the position data is updated, and the old value is returned.
|
||||
/// - wasn't present before, [None] is returned.
|
||||
/// - wasn't present before, `None` is returned.
|
||||
pub fn set(&mut self, input_device: T, position_data: f32) -> Option<f32> {
|
||||
self.axis_data.insert(input_device, position_data)
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ pub struct Wireframe;
|
|||
#[derive(Resource, Debug, Clone, Default, ExtractResource, Reflect)]
|
||||
#[reflect(Resource)]
|
||||
pub struct WireframeConfig {
|
||||
/// Whether to show wireframes for all meshes. If `false`, only meshes with a [Wireframe] component will be rendered.
|
||||
/// Whether to show wireframes for all meshes. If `false`, only meshes with a [`Wireframe`] component will be rendered.
|
||||
pub global: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::ops::{Deref, DerefMut};
|
|||
/// ## Context
|
||||
///
|
||||
/// [`ExtractSchedule`] is used to extract (move) data from the simulation world ([`MainWorld`]) to the
|
||||
/// render world. The render world drives rendering each frame (generally to a [Window]).
|
||||
/// render world. The render world drives rendering each frame (generally to a `Window`).
|
||||
/// This design is used to allow performing calculations related to rendering a prior frame at the same
|
||||
/// time as the next frame is simulated, which increases throughput (FPS).
|
||||
///
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::{
|
|||
/// Tasks are also futures themselves and yield the output of the spawned future.
|
||||
///
|
||||
/// When a task is dropped, its gets canceled and won't be polled again. To cancel a task a bit
|
||||
/// more gracefully and wait until it stops running, use the [`cancel()`][Task::cancel()] method.
|
||||
/// more gracefully and wait until it stops running, use the [`Task::cancel()`] method.
|
||||
///
|
||||
/// Tasks that panic get immediately canceled. Awaiting a canceled task also causes a panic.
|
||||
/// Wraps `async_executor::Task`
|
||||
|
|
|
@ -35,7 +35,7 @@ use crate::fixed_timestep::run_fixed_update_schedule;
|
|||
pub struct TimePlugin;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)]
|
||||
/// Updates the elapsed time. Any system that interacts with [Time] component should run after
|
||||
/// Updates the elapsed time. Any system that interacts with [`Time`] component should run after
|
||||
/// this.
|
||||
pub struct TimeSystem;
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ macro_rules! define_boxed_label {
|
|||
($label_trait_name:ident) => {
|
||||
/// A strongly-typed label.
|
||||
pub trait $label_trait_name: 'static + Send + Sync + ::std::fmt::Debug {
|
||||
/// Return's the [TypeId] of this label, or the the ID of the
|
||||
/// wrappped label type for `Box<dyn
|
||||
/// Return's the [`TypeId`] of this label, or the the ID of the
|
||||
/// wrapped label type for `Box<dyn
|
||||
#[doc = stringify!($label_trait_name)]
|
||||
/// >`
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue