1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use specs::{RunNow, System, World};

/// Initializes a `System` with some interaction with the `World`.
pub trait SystemDesc<'a, 'b, S>
where
    S: System<'a>,
{
    /// Builds and returns a `System`.
    ///
    /// # Parameters
    ///
    /// * `world`: `World` that the system will run on.
    fn build(self, world: &mut World) -> S;
}

/// Initializes a `RunNow` with some interaction with the `World`.
pub trait RunNowDesc<'a, 'b, S>
where
    S: RunNow<'b>,
{
    /// Builds and returns a `System`.
    ///
    /// # Parameters
    ///
    /// * `world`: `World` that the system will run on.
    fn build(self, world: &mut World) -> S;
}