[][src]Trait specs::SystemData

pub trait SystemData<'a> {
    fn setup(world: &mut World);
fn fetch(world: &'a World) -> Self;
fn reads() -> Vec<ResourceId>;
fn writes() -> Vec<ResourceId>; }

A static system data that can specify its dependencies at statically (at compile-time). Most system data is a SystemData, the DynamicSystemData type is only needed for very special setups.

You can derive this using the #[derive(SystemData)] macro provided by shred-derive. That is as simple as enabling the shred-derive feature.

Examples

use shred::{Read, ResourceId, SystemData, World, Write};

pub struct Clock;
pub struct Timer;

// This will implement `SystemData` for `MySystemData`.
// Please note that this will only work if `SystemData`, `World` and `ResourceId` are included.
#[derive(SystemData)]
pub struct MySystemData<'a> {
    pub clock: Read<'a, Clock>,
    pub timer: Write<'a, Timer>,
}

Required methods

fn setup(world: &mut World)

Sets up the system data for fetching it from the World.

fn fetch(world: &'a World) -> Self

Fetches the system data from World. Note that this is only specified for one concrete lifetime 'a, you need to implement the SystemData trait for every possible lifetime.

fn reads() -> Vec<ResourceId>

Returns all read dependencies as fetched from Self::fetch.

Please note that returning wrong dependencies can lead to a panic.

fn writes() -> Vec<ResourceId>

Returns all write dependencies as fetched from Self::fetch.

Please note that returning wrong dependencies can lead to a panic.

Loading content...

Implementations on Foreign Types

impl<'a> SystemData<'a> for ()[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>,
    U: SystemData<'a>,
    V: SystemData<'a>,
    W: SystemData<'a>,
    X: SystemData<'a>,
    Y: SystemData<'a>, 
[src]

impl<'a, A, B> SystemData<'a> for (A, B) where
    A: SystemData<'a>,
    B: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G> SystemData<'a> for (A, B, C, D, E, F, G) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H> SystemData<'a> for (A, B, C, D, E, F, G, H) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>, 
[src]

impl<'a, A> SystemData<'a> for (A,) where
    A: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>,
    U: SystemData<'a>,
    V: SystemData<'a>,
    W: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>,
    U: SystemData<'a>,
    V: SystemData<'a>,
    W: SystemData<'a>,
    X: SystemData<'a>,
    Y: SystemData<'a>,
    Z: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>,
    U: SystemData<'a>,
    V: SystemData<'a>,
    W: SystemData<'a>,
    X: SystemData<'a>, 
[src]

impl<'a, A, B, C> SystemData<'a> for (A, B, C) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I> SystemData<'a> for (A, B, C, D, E, F, G, H, I) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>, 
[src]

impl<'a, A, B, C, D> SystemData<'a> for (A, B, C, D) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>,
    U: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>, 
[src]

impl<'a, T> SystemData<'a> for PhantomData<T> where
    T: ?Sized
[src]

impl<'a, T, F> SystemData<'a> for Option<Read<'a, T, F>> where
    T: Resource
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>,
    S: SystemData<'a>,
    T: SystemData<'a>,
    U: SystemData<'a>,
    V: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F> SystemData<'a> for (A, B, C, D, E, F) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E> SystemData<'a> for (A, B, C, D, E) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>, 
[src]

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> SystemData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) where
    A: SystemData<'a>,
    B: SystemData<'a>,
    C: SystemData<'a>,
    D: SystemData<'a>,
    E: SystemData<'a>,
    F: SystemData<'a>,
    G: SystemData<'a>,
    H: SystemData<'a>,
    I: SystemData<'a>,
    J: SystemData<'a>,
    K: SystemData<'a>,
    L: SystemData<'a>,
    M: SystemData<'a>,
    N: SystemData<'a>,
    O: SystemData<'a>,
    P: SystemData<'a>,
    Q: SystemData<'a>,
    R: SystemData<'a>, 
[src]

impl<'a, T, F> SystemData<'a> for Option<Write<'a, T, F>> where
    T: Resource
[src]

Loading content...

Implementors

impl<'a, T> SystemData<'a> for ReadStorage<'a, T> where
    T: Component
[src]

impl<'a, T> SystemData<'a> for WriteStorage<'a, T> where
    T: Component
[src]

impl<'a, T, F> SystemData<'a> for Read<'a, T, F> where
    F: SetupHandler<T>,
    T: Resource
[src]

impl<'a, T, F> SystemData<'a> for Write<'a, T, F> where
    F: SetupHandler<T>,
    T: Resource
[src]

Loading content...