Clarify docs for RenderLayers::layer
(#14871)
# Objective `RenderLayers` was marketed as being unlimited in the Bevy 0.14 release notes, but the most obvious constructor doesn't actually support unlimited layers. We should explicitly document this. ## Solution Add some docs mentioning the limit and pointing the user to `with` or `from_layers` if they need an arbitrary number of layers.
This commit is contained in:
parent
938d810766
commit
3e86787e93
@ -58,6 +58,10 @@ impl Default for RenderLayers {
|
|||||||
|
|
||||||
impl RenderLayers {
|
impl RenderLayers {
|
||||||
/// Create a new `RenderLayers` belonging to the given layer.
|
/// Create a new `RenderLayers` belonging to the given layer.
|
||||||
|
///
|
||||||
|
/// This `const` constructor is limited to `size_of::<usize>()` layers.
|
||||||
|
/// If you need to support an arbitrary number of layers, use [`with`](RenderLayers::with)
|
||||||
|
/// or [`from_layers`](RenderLayers::from_layers).
|
||||||
pub const fn layer(n: Layer) -> Self {
|
pub const fn layer(n: Layer) -> Self {
|
||||||
let (buffer_index, bit) = Self::layer_info(n);
|
let (buffer_index, bit) = Self::layer_info(n);
|
||||||
assert!(
|
assert!(
|
||||||
@ -135,7 +139,7 @@ impl RenderLayers {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get the bitmask representation of the contained layers
|
/// Get the bitmask representation of the contained layers.
|
||||||
pub fn bits(&self) -> &[u64] {
|
pub fn bits(&self) -> &[u64] {
|
||||||
self.0.as_slice()
|
self.0.as_slice()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user