Skip to main content

Crate bevy_pipe_affect

Crate bevy_pipe_affect 

Source
Expand description

§bevy_pipe_affect
Write systems as pure functions

Normally, Bevy systems perform some state changes as side effects. This crate enables you to instead return Effects as system output.

Effects define an ECS state transition. All common ECS operations have one or more Effect types provided in the library.

These “systems with effects” can then be .pipe(affect)-ed. The affect system will perform the state transition.

This enables a more functional code-style in bevy app development. User-written systems can all be read-only, pure functions. All mutability can be piped out of your code.

§This API Reference

The purpose of this API reference is to describe the API provided by this library. More explanation-oriented documentation, tutorials, and guides are available in the bevy_pipe_affect book.

The following are good jumping-off points for beginners:

Cargo examples are also available in this library’s github repository.

§Feature flags

This crate provides the following set of feature flags:

  • derive: enables the Effect derive macro for structs and enums of effects
  • asset: enables the bevy/bevy_asset feature and Asset-related effects

None of these are enabled by default.

Modules§

effect_composition
Effect composition functions, that can be used with in_and_then_compose and EffectOut::and_then_compose.
effects
Effect implementors and their constructors.
prelude
use bevy_pipe_affect::prelude::*; to import common items.
query_data_effects
Contains implementations of QueryDataEffect
system_combinators
bevy systems and higher-order system constructors related to effects piping and composition.

Structs§

EffectOut
An Effect and an output.

Traits§

Effect
Define a state transition in bevy’s ECS.
QueryDataEffect
Define a state transition for the QueryData of individual entities.

Functions§

effect_out
Construct a new EffectOut.

Derive Macros§

Effect
Derive macro for the Effect trait. See that trait for more details.