diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 04d14f9afe652..234000ef855d8 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -96,6 +96,34 @@ pub fn assert_is_system>(sys: S) } } +/// Ensure that a given function is an exclusive system +/// +/// This should be used when writing doc examples, +/// to confirm that systems used in an example are +/// valid exclusive systems +/// +/// Passing assert +/// ``` +/// # use bevy_ecs::prelude::World; +/// # use bevy_ecs::system::assert_is_exclusive_system; +/// fn an_exclusive_system(_world: &mut World) {} +/// +/// assert_is_exclusive_system(an_exclusive_system); +/// ``` +/// +/// Failing assert +/// ```compile_fail +/// # use bevy_ecs::prelude::World; +/// # use bevy_ecs::system::assert_is_exclusive_system; +/// fn not_an_exclusive_system(_world: &mut World, number: f32) {} +/// +/// assert_is_exclusive_system(not_an_exclusive_system); +/// ``` +pub fn assert_is_exclusive_system( + _sys: impl IntoExclusiveSystem, +) { +} + #[cfg(test)] mod tests { use std::any::TypeId;