# Objective Resolves #10743. ## Solution Copied over the documentation written by @stepancheng from PR #10718. I left out the lines from the doctest where `<()>` is removed, as that seemed to be the part people couldn't decide on whether to keep or not.
This commit is contained in:
parent
53919c3e70
commit
1e2132672e
@ -13,6 +13,22 @@ pub type BoxedCondition<In = ()> = Box<dyn ReadOnlySystem<In = In, Out = bool>>;
|
|||||||
/// Implemented for functions and closures that convert into [`System<Out=bool>`](crate::system::System)
|
/// Implemented for functions and closures that convert into [`System<Out=bool>`](crate::system::System)
|
||||||
/// with [read-only](crate::system::ReadOnlySystemParam) parameters.
|
/// with [read-only](crate::system::ReadOnlySystemParam) parameters.
|
||||||
///
|
///
|
||||||
|
/// # Marker type parameter
|
||||||
|
///
|
||||||
|
/// `Condition` trait has `Marker` type parameter, which has no special meaning,
|
||||||
|
/// but exists to work around the limitation of Rust's trait system.
|
||||||
|
///
|
||||||
|
/// Type parameter in return type can be set to `<()>` by calling [`IntoSystem::into_system`],
|
||||||
|
/// but usually have to be specified when passing a condition to a function.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// # use bevy_ecs::schedule::Condition;
|
||||||
|
/// # use bevy_ecs::system::IntoSystem;
|
||||||
|
/// fn not_condition<Marker>(a: impl Condition<Marker>) -> impl Condition<()> {
|
||||||
|
/// IntoSystem::into_system(a.map(|x| !x))
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// A condition that returns true every other time it's called.
|
/// A condition that returns true every other time it's called.
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user