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>
This commit is contained in:
Joseph 2024-07-01 07:47:13 -07:00 committed by GitHub
parent f7bc0a01dd
commit 9055fc1d68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/bevyengine/bevy"
documentation = "https://docs.rs/bevy"
rust-version = "1.78.0"
rust-version = "1.79.0"
[workspace]
exclude = [

View file

@ -49,8 +49,10 @@ impl FromIterator<Layer> for RenderLayers {
impl Default for RenderLayers {
/// By default, this structure includes layer `0`, which represents the first layer.
///
/// This is distinct from [`RenderLayers::none`], which doesn't belong to any layers.
fn default() -> Self {
Self::layer(0)
const { Self::layer(0) }
}
}
@ -68,6 +70,8 @@ impl RenderLayers {
}
/// Create a new `RenderLayers` that belongs to no layers.
///
/// This is distinct from [`RenderLayers::default`], which belongs to the first layer.
pub const fn none() -> Self {
RenderLayers(SmallVec::from_const([0; INLINE_BLOCKS]))
}