Skip to content

Commit 9055fc1

Browse files
Clarify the difference between default render layers and none render layers (#14075)
# Objective It's not always obvious what the default value for `RenderLayers` represents. It is documented, but since it's an implementation of a trait method the documentation may or may not be shown depending on the IDE. ## Solution Add documentation to the `none` method that explicitly calls out the difference. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
1 parent f7bc0a0 commit 9055fc1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
1010
license = "MIT OR Apache-2.0"
1111
repository = "https://github.com/bevyengine/bevy"
1212
documentation = "https://docs.rs/bevy"
13-
rust-version = "1.78.0"
13+
rust-version = "1.79.0"
1414

1515
[workspace]
1616
exclude = [

crates/bevy_render/src/view/visibility/render_layers.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ impl FromIterator<Layer> for RenderLayers {
4949

5050
impl Default for RenderLayers {
5151
/// By default, this structure includes layer `0`, which represents the first layer.
52+
///
53+
/// This is distinct from [`RenderLayers::none`], which doesn't belong to any layers.
5254
fn default() -> Self {
53-
Self::layer(0)
55+
const { Self::layer(0) }
5456
}
5557
}
5658

@@ -68,6 +70,8 @@ impl RenderLayers {
6870
}
6971

7072
/// Create a new `RenderLayers` that belongs to no layers.
73+
///
74+
/// This is distinct from [`RenderLayers::default`], which belongs to the first layer.
7175
pub const fn none() -> Self {
7276
RenderLayers(SmallVec::from_const([0; INLINE_BLOCKS]))
7377
}

0 commit comments

Comments
 (0)