use std::ptr::NonNull; use crate::{world::World, Access}; pub mod graph; pub use graph::*; pub mod criteria; pub use criteria::*; pub mod batched; pub use batched::*; pub mod fn_sys; pub use fn_sys::*; /// A system that does not mutate the world pub trait System { /// A method that indicates the type of access of the world the system requires. fn world_access(&self) -> Access; /// The actual execution of the system. fn execute(&mut self, world: NonNull) -> anyhow::Result<()>; /// A setup step of the System, called before `execute` ever runs. fn setup(&self, world: NonNull) -> anyhow::Result<()> { let _ = world; Ok(()) } } pub trait IntoSystem { type System: System; fn into_system(self) -> Self::System; }