//! Contains contracts for defining a system.

use super::world::World;

/// Defines behavior by enacting mutation upon entities.
///
/// Systems contain no state on their own and can often be represented by a function.
pub trait System {
    /// Executes the system.
    fn run(&self, entities: &mut World);
}

impl<TFunc> System for TFunc
    where
        TFunc: Fn(&mut World),
{
    fn run(&self, world: &mut World) {
        self(world);
    }
}

