Unify crate-level preludes (#15080)

# Objective

- Crate-level prelude modules, such as `bevy_ecs::prelude`, are plagued
with inconsistency! Let's fix it!

## Solution

Format all preludes based on the following rules:

1. All preludes should have brief documentation in the format of:
   > The _name_ prelude.
   >
> This includes the most common types in this crate, re-exported for
your convenience.
2. All documentation should be outer, not inner. (`///` instead of
`//!`.)
3. No prelude modules should be annotated with `#[doc(hidden)]`. (Items
within them may, though I'm not sure why this was done.)

## Testing

- I manually searched for the term `mod prelude` and updated all
occurrences by hand. 🫠

---------

Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
This commit is contained in:
BD103 2024-09-08 13:10:57 -04:00 committed by GitHub
parent b738f081f8
commit 6ec6a55645
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 91 additions and 24 deletions

View file

@ -39,7 +39,9 @@ use serde::{Deserialize, Serialize};
use thread_local::ThreadLocal; use thread_local::ThreadLocal;
use uuid::Uuid; use uuid::Uuid;
#[allow(missing_docs)] /// The animation prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -27,7 +27,9 @@ pub use sub_app::*;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub use terminal_ctrl_c_handler::*; pub use terminal_ctrl_c_handler::*;
#[allow(missing_docs)] /// The app prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -12,6 +12,9 @@ pub mod processor;
pub mod saver; pub mod saver;
pub mod transformer; pub mod transformer;
/// The asset prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -33,7 +33,9 @@ mod audio_source;
mod pitch; mod pitch;
mod sinks; mod sinks;
#[allow(missing_docs)] /// The audio prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -111,7 +111,9 @@ mod test_colors;
mod testing; mod testing;
mod xyza; mod xyza;
/// Commonly used color types and traits. /// The color prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
pub use crate::color::*; pub use crate::color::*;
pub use crate::color_ops::*; pub use crate::color_ops::*;

View file

@ -16,8 +16,10 @@ use bevy_ecs::system::Resource;
pub use name::*; pub use name::*;
pub use task_pool_options::*; pub use task_pool_options::*;
/// The core prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
//! The Bevy Core Prelude.
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{
FrameCountPlugin, Name, NameOrEntity, TaskPoolOptions, TaskPoolPlugin, FrameCountPlugin, Name, NameOrEntity, TaskPoolOptions, TaskPoolPlugin,

View file

@ -41,6 +41,9 @@ pub mod experimental {
} }
} }
/// The core pipeline prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -36,7 +36,9 @@ pub mod world;
pub use bevy_ptr as ptr; pub use bevy_ptr as ptr;
/// Most commonly used re-exported types. /// The ECS prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
#[cfg(feature = "reflect_functions")] #[cfg(feature = "reflect_functions")]

View file

@ -51,7 +51,9 @@ mod pipeline_2d;
#[cfg(all(feature = "bevy_pbr", feature = "bevy_render"))] #[cfg(all(feature = "bevy_pbr", feature = "bevy_render"))]
mod pipeline_3d; mod pipeline_3d;
/// The `bevy_gizmos` prelude. /// The gizmos prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[cfg(feature = "bevy_render")] #[cfg(feature = "bevy_render")]
pub use crate::aabb::{AabbGizmoConfigGroup, ShowAabbGizmo}; pub use crate::aabb::{AabbGizmoConfigGroup, ShowAabbGizmo};

View file

@ -115,7 +115,9 @@ use bevy_render::{
}; };
use bevy_scene::Scene; use bevy_scene::Scene;
/// The `bevy_gltf` prelude. /// The glTF prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{Gltf, GltfAssetLabel, GltfExtras}; pub use crate::{Gltf, GltfAssetLabel, GltfExtras};

View file

@ -69,7 +69,9 @@ pub use valid_parent_check_plugin::*;
mod query_extension; mod query_extension;
pub use query_extension::*; pub use query_extension::*;
#[doc(hidden)] /// The hierarchy prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{child_builder::*, components::*, hierarchy::*, query_extension::*}; pub use crate::{child_builder::*, components::*, hierarchy::*, query_extension::*};

View file

@ -24,7 +24,9 @@ pub mod touch;
pub use axis::*; pub use axis::*;
pub use button_input::*; pub use button_input::*;
/// Most commonly used re-exported types. /// The input prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -28,8 +28,10 @@ mod android_tracing;
static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> = static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> =
tracy_client::ProfiledAllocator::new(std::alloc::System, 100); tracy_client::ProfiledAllocator::new(std::alloc::System, 100);
/// The log prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
//! The Bevy Log Prelude.
#[doc(hidden)] #[doc(hidden)]
pub use bevy_utils::tracing::{ pub use bevy_utils::tracing::{
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span, debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,

View file

@ -43,7 +43,9 @@ pub use rotation2d::Rot2;
#[cfg(feature = "rand")] #[cfg(feature = "rand")]
pub use sampling::{FromRng, ShapeSample}; pub use sampling::{FromRng, ShapeSample};
/// The `bevy_math` prelude. /// The math prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
#[cfg(feature = "rand")] #[cfg(feature = "rand")]

View file

@ -61,6 +61,9 @@ pub use volumetric_fog::{
FogVolume, FogVolumeBundle, VolumetricFogPlugin, VolumetricFogSettings, VolumetricLight, FogVolume, FogVolumeBundle, VolumetricFogPlugin, VolumetricFogSettings, VolumetricLight,
}; };
/// The PBR prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -35,7 +35,9 @@ use bevy_ecs::prelude::*;
use bevy_math::Vec3; use bevy_math::Vec3;
use bevy_reflect::Reflect; use bevy_reflect::Reflect;
/// Common imports for implementing a picking backend. /// The picking backend prelude.
///
/// This includes the most common types in this module, re-exported for your convenience.
pub mod prelude { pub mod prelude {
pub use super::{ray::RayMap, HitData, PointerHits}; pub use super::{ray::RayMap, HitData, PointerHits};
pub use crate::{ pub use crate::{

View file

@ -29,7 +29,9 @@ use crate::{
use crate::PickSet; use crate::PickSet;
/// Common imports for `bevy_picking`. /// The picking input prelude.
///
/// This includes the most common types in this module, re-exported for your convenience.
pub mod prelude { pub mod prelude {
pub use crate::input::PointerInputPlugin; pub use crate::input::PointerInputPlugin;
} }

View file

@ -160,7 +160,9 @@ use bevy_app::prelude::*;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_reflect::prelude::*; use bevy_reflect::prelude::*;
/// common exports for picking interaction /// The picking prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -564,6 +564,9 @@ pub mod serde;
pub mod std_traits; pub mod std_traits;
pub mod utility; pub mod utility;
/// The reflect prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
pub use crate::std_traits::*; pub use crate::std_traits::*;
#[doc(hidden)] #[doc(hidden)]

View file

@ -38,6 +38,10 @@ mod spatial_bundle;
pub mod storage; pub mod storage;
pub mod texture; pub mod texture;
pub mod view; pub mod view;
/// The render prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -34,7 +34,9 @@ pub use scene_filter::*;
pub use scene_loader::*; pub use scene_loader::*;
pub use scene_spawner::*; pub use scene_spawner::*;
#[allow(missing_docs)] /// The scene prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -19,6 +19,9 @@ mod texture_atlas;
mod texture_atlas_builder; mod texture_atlas_builder;
mod texture_slice; mod texture_slice;
/// The sprite prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[allow(deprecated)] #[allow(deprecated)]
#[doc(hidden)] #[doc(hidden)]

View file

@ -47,7 +47,9 @@ pub mod state_scoped;
/// Provides definitions for the basic traits required by the state system /// Provides definitions for the basic traits required by the state system
pub mod reflect; pub mod reflect;
/// Most commonly used re-exported types. /// The state prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[cfg(feature = "bevy_app")] #[cfg(feature = "bevy_app")]
#[doc(hidden)] #[doc(hidden)]

View file

@ -44,7 +44,9 @@ pub use iter::ParallelIterator;
pub use futures_lite; pub use futures_lite;
#[allow(missing_docs)] /// The tasks prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -55,7 +55,9 @@ pub use pipeline::*;
pub use text::*; pub use text::*;
pub use text2d::*; pub use text2d::*;
/// Most commonly used re-exported types. /// The text prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{Font, JustifyText, Text, Text2dBundle, TextError, TextSection, TextStyle}; pub use crate::{Font, JustifyText, Text, Text2dBundle, TextError, TextSection, TextStyle};

View file

@ -23,8 +23,10 @@ pub use time::*;
pub use timer::*; pub use timer::*;
pub use virt::*; pub use virt::*;
/// The time prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
//! The Bevy Time Prelude.
#[doc(hidden)] #[doc(hidden)]
pub use crate::{Fixed, Real, Time, Timer, TimerMode, Virtual}; pub use crate::{Fixed, Real, Time, Timer, TimerMode, Virtual};
} }

View file

@ -29,7 +29,9 @@ pub mod helper;
#[cfg(feature = "bevy-support")] #[cfg(feature = "bevy-support")]
pub mod systems; pub mod systems;
#[doc(hidden)] /// The transform prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::components::*; pub use crate::components::*;

View file

@ -40,7 +40,9 @@ pub use ui_material::*;
pub use ui_node::*; pub use ui_node::*;
use widget::UiImageSize; use widget::UiImageSize;
#[doc(hidden)] /// The UI prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use crate::{ pub use crate::{

View file

@ -10,7 +10,9 @@
//! [Bevy]: https://bevyengine.org/ //! [Bevy]: https://bevyengine.org/
//! //!
#[allow(missing_docs)] /// The utilities prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
pub use crate::default; pub use crate::default;
} }

View file

@ -30,7 +30,9 @@ pub use system::*;
pub use system_cursor::*; pub use system_cursor::*;
pub use window::*; pub use window::*;
#[allow(missing_docs)] /// The windowing prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
#[allow(deprecated)] #[allow(deprecated)]
#[doc(hidden)] #[doc(hidden)]