use std::ptr::NonNull; use crate::{world::World, Access}; mod graph; pub use graph::*; mod criteria; pub use criteria::*; mod batched; pub use batched::*; 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(()) } fn execute_deferred(&mut self, world: NonNull) -> anyhow::Result<()>; } pub trait IntoSystem { type System: System; fn into_system(self) -> Self::System; }