Skip to content

Commit

Permalink
Fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondolf committed Feb 17, 2024
1 parent cef9825 commit 4cb71e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<L: PhysicsLayer> PhysicsLayer for &L {
#[cfg_attr(feature = "2d", doc = "# use bevy_xpbd_2d::prelude::*;")]
#[cfg_attr(feature = "3d", doc = "# use bevy_xpbd_3d::prelude::*;")]
/// #
/// #[derive(PhysicsLayer)]
/// #[derive(PhysicsLayer, Clone, Copy, Debug)]
/// enum GameLayer {
/// Player, // Layer 0
/// Enemy, // Layer 1
Expand All @@ -58,6 +58,8 @@ impl<L: PhysicsLayer> PhysicsLayer for &L {
/// Another way to use [`LayerMask`] is to define layers as constants:
///
/// ```
#[cfg_attr(feature = "2d", doc = "# use bevy_xpbd_2d::prelude::*;")]
#[cfg_attr(feature = "3d", doc = "# use bevy_xpbd_3d::prelude::*;")]
/// // `1 << n` is bitshifting: the first layer shifted by `n` layers.
/// pub const FIRST_LAYER: LayerMask = LayerMask(1 << 0);
/// pub const LAST_LAYER: LayerMask = LayerMask(1 << 31);
Expand Down Expand Up @@ -115,7 +117,7 @@ impl LayerMask {
/// layers.add(0b0001);
/// layers |= 0b0001;
///
/// assert_eq!(layers, 0b0001);
/// assert_eq!(layers, 0b1011);
/// ```
pub fn add(&mut self, layers: impl Into<Self>) {
let layers: LayerMask = layers.into();
Expand Down Expand Up @@ -308,7 +310,7 @@ impl Not for LayerMask {
/// ```
#[cfg_attr(feature = "2d", doc = "# use bevy_xpbd_2d::prelude::*;")]
#[cfg_attr(feature = "3d", doc = "# use bevy_xpbd_3d::prelude::*;")]
/// let layers = CollisionLayers::new(0b0010, 0b1011);
/// let mut layers = CollisionLayers::new(0b0010, 0b1011);
///
/// // Add memberships (these are equivalent)
/// layers.memberships.add(0b0001);
Expand Down

0 comments on commit 4cb71e9

Please sign in to comment.