Skip to content

Commit f41f206

Browse files
authored
Improve bevy crate's docs (#748)
Change `bevy` crates re-exports to modules
1 parent 1b051d3 commit f41f206

File tree

1 file changed

+102
-26
lines changed

1 file changed

+102
-26
lines changed

src/lib.rs

Lines changed: 102 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,58 +30,134 @@
3030
//! The defaults provide a "full" engine experience, but you can easily enable / disable features
3131
//! in your project's `Cargo.toml` to meet your specific needs. See Bevy's `Cargo.toml` for a full list of features available.
3232
//!
33-
//! If you prefer it, you can also consume the individual bevy crates directly.
33+
//! If you prefer, you can also consume the individual bevy crates directly.
34+
//! Each module in the root of this crate, except for the prelude, can be found on crates.io
35+
//! with `bevy_` appended to the front, e.g. `app` -> [`bevy_app`](https://docs.rs/bevy_app/0.2.1/bevy_app/).
3436
3537
#![doc(
3638
html_logo_url = "https://bevyengine.org/assets/icon.png",
3739
html_favicon_url = "https://bevyengine.org/assets/icon.png"
3840
)]
3941

40-
mod default_plugins;
42+
/// `use bevy::prelude::*;` to import common components, bundles, and plugins.
4143
pub mod prelude;
4244

43-
pub use bevy_app as app;
44-
pub use bevy_asset as asset;
45-
pub use bevy_core as core;
46-
pub use bevy_diagnostic as diagnostic;
47-
pub use bevy_ecs as ecs;
48-
pub use bevy_input as input;
49-
pub use bevy_math as math;
50-
pub use bevy_property as property;
51-
pub use bevy_scene as scene;
52-
pub use bevy_tasks as tasks;
53-
pub use bevy_transform as transform;
54-
pub use bevy_type_registry as type_registry;
55-
pub use bevy_utils as utils;
56-
pub use bevy_window as window;
45+
mod default_plugins;
5746
pub use default_plugins::*;
5847

48+
pub mod app {
49+
//! Build bevy apps, create plugins, and read events.
50+
pub use bevy_app::*;
51+
}
52+
53+
pub mod asset {
54+
//! Load and store assets and resources for Apps
55+
pub use bevy_asset::*;
56+
}
57+
58+
pub mod core {
59+
//! Contains core plugins and utilities for time.
60+
pub use bevy_core::*;
61+
}
62+
63+
pub mod diagnostic {
64+
//! Useful diagnostic plugins and types for bevy apps.
65+
pub use bevy_diagnostic::*;
66+
}
67+
68+
pub mod ecs {
69+
//! Bevy's entity-component-system.
70+
pub use bevy_ecs::*;
71+
}
72+
73+
pub mod input {
74+
//! Resources and events for inputs, e.g. mouse/keyboard, touch, gamepads, etc.
75+
pub use bevy_input::*;
76+
}
77+
78+
pub mod math {
79+
pub use bevy_math::*;
80+
}
81+
82+
pub mod property {
83+
//! Dynamically interact with struct fields and names.
84+
pub use bevy_property::*;
85+
}
86+
87+
pub mod scene {
88+
pub use bevy_scene::*;
89+
}
90+
91+
pub mod tasks {
92+
pub use bevy_tasks::*;
93+
}
94+
95+
pub mod transform {
96+
pub use bevy_transform::*;
97+
}
98+
99+
pub mod type_registry {
100+
pub use bevy_type_registry::*;
101+
}
102+
103+
pub mod utils {
104+
pub use bevy_utils::*;
105+
}
106+
107+
pub mod window {
108+
pub use bevy_window::*;
109+
}
110+
59111
#[cfg(feature = "bevy_audio")]
60-
pub use bevy_audio as audio;
112+
pub mod audio {
113+
//! Provides types and plugins for audio playback.
114+
pub use bevy_audio::*;
115+
}
61116

62117
#[cfg(feature = "bevy_gltf")]
63-
pub use bevy_gltf as gltf;
118+
pub mod gltf {
119+
//! Support for GLTF file loading.
120+
pub use bevy_gltf::*;
121+
}
64122

65123
#[cfg(feature = "bevy_pbr")]
66-
pub use bevy_pbr as pbr;
124+
pub mod pbr {
125+
//! Physically based rendering. **Note**: true PBR has not yet been implemented; the name `pbr` is aspirational.
126+
pub use bevy_pbr::*;
127+
}
67128

68129
#[cfg(feature = "bevy_render")]
69-
pub use bevy_render as render;
130+
pub mod render {
131+
pub use bevy_render::*;
132+
}
70133

71134
#[cfg(feature = "bevy_sprite")]
72-
pub use bevy_sprite as sprite;
135+
pub mod sprite {
136+
//! Items for sprites, rects, texture atlases, etc.
137+
pub use bevy_sprite::*;
138+
}
73139

74140
#[cfg(feature = "bevy_text")]
75-
pub use bevy_text as text;
141+
pub mod text {
142+
pub use bevy_text::*;
143+
}
76144

77145
#[cfg(feature = "bevy_ui")]
78-
pub use bevy_ui as ui;
146+
pub mod ui {
147+
pub use bevy_ui::*;
148+
}
79149

80150
#[cfg(feature = "bevy_winit")]
81-
pub use bevy_winit as winit;
151+
pub mod winit {
152+
pub use bevy_winit::*;
153+
}
82154

83155
#[cfg(feature = "bevy_wgpu")]
84-
pub use bevy_wgpu as wgpu;
156+
pub mod wgpu {
157+
pub use bevy_wgpu::*;
158+
}
85159

86160
#[cfg(feature = "bevy_dynamic_plugin")]
87-
pub use bevy_dynamic_plugin as dynamic_plugin;
161+
pub mod dynamic_plugin {
162+
pub use bevy_dynamic_plugin::*;
163+
}

0 commit comments

Comments
 (0)