Skip to content

Commit

Permalink
Move default docs (#9638)
Browse files Browse the repository at this point in the history
# Objective

- Make the default docs more useful like suggested in
#9600 (comment)

## Solution

- Move the documentation to the `fn default()` method instead of the
`impl Default`.

Allows you to view the docs directly on the function without having to
go to the implementation.

### Before
![Screenshot 2023-08-29 at 18 21
03](https://github.com/bevyengine/bevy/assets/104745335/6d31591e-f190-4b8e-8bc3-a570ada294f0)

### After
![Screenshot 2023-08-29 at 18 19
54](https://github.com/bevyengine/bevy/assets/104745335/e2442ec1-593d-47f3-b539-8c77a170f0b6)
  • Loading branch information
ameknite authored Aug 30, 2023
1 parent f2f39c8 commit fb094ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions crates/bevy_ecs/src/schedule/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ pub struct Schedule {
#[derive(ScheduleLabel, Hash, PartialEq, Eq, Debug, Clone)]
struct DefaultSchedule;

/// Creates a schedule with a default label. Only use in situations where
/// where you don't care about the [`ScheduleLabel`]. Inserting a default schedule
/// into the world risks overwriting another schedule. For most situations you should use
/// [`Schedule::new`].
impl Default for Schedule {
/// Creates a schedule with a default label. Only use in situations where
/// you don't care about the [`ScheduleLabel`]. Inserting a default schedule
/// into the world risks overwriting another schedule. For most situations
/// you should use [`Schedule::new`].
fn default() -> Self {
Self::new(DefaultSchedule)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/view/visibility/render_layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl std::iter::FromIterator<Layer> for RenderLayers {
}
}

/// Defaults to containing to layer `0`, the first layer.
impl Default for RenderLayers {
/// By default, this structure includes layer `0`, which represents the first layer.
fn default() -> Self {
RenderLayers::layer(0)
}
Expand Down

0 comments on commit fb094ea

Please sign in to comment.