Skip to main content

IntoSystem

Trait IntoSystem 

Source
pub trait IntoSystem<Marker = ()> {
    type System: System + 'static;

    // Required method
    fn into_system(self) -> BoxedSystem;
}
Expand description

A trait for types that can be converted into a System.

This trait enables ergonomic system registration by allowing functions and other types to be automatically converted into boxed systems.

§Implemented For

  • Any type implementing System
  • Functions with valid system parameters (future, Step 3.1.5)

§Example

use goud_engine::ecs::{World};
use goud_engine::ecs::system::{System, BoxedSystem, IntoSystem};

struct MySystem;

impl System for MySystem {
    fn name(&self) -> &'static str { "MySystem" }
    fn run(&mut self, _world: &mut World) {}
}

// Convert to BoxedSystem using IntoSystem
let boxed: BoxedSystem = MySystem.into_system();
assert_eq!(boxed.name(), "MySystem");

Required Associated Types§

Source

type System: System + 'static

The concrete system type this converts to.

Required Methods§

Source

fn into_system(self) -> BoxedSystem

Converts this into a system.

Implementors§

Source§

impl<F> IntoSystem<(FnMarker,)> for F
where F: FnMut() + Send + 'static,

Source§

type System = FunctionSystem<FnMarker, F>

Source§

impl<F, P1: SystemParam + 'static> IntoSystem<(FnMarker1<P1>,)> for F
where for<'w, 's> F: FnMut(P1) + Send + 'static + FnMut(P1::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker1<P1>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static> IntoSystem<(FnMarker2<P1, P2>,)> for F
where for<'w, 's> F: FnMut(P1, P2) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker2<P1, P2>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static> IntoSystem<(FnMarker3<P1, P2, P3>,)> for F
where for<'w, 's> F: FnMut(P1, P2, P3) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>, P3::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static, P3::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker3<P1, P2, P3>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static> IntoSystem<(FnMarker4<P1, P2, P3, P4>,)> for F
where for<'w, 's> F: FnMut(P1, P2, P3, P4) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>, P3::Item<'w, 's>, P4::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static, P3::State: Send + Sync + Clone + 'static, P4::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker4<P1, P2, P3, P4>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static> IntoSystem<(FnMarker5<P1, P2, P3, P4, P5>,)> for F
where for<'w, 's> F: FnMut(P1, P2, P3, P4, P5) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>, P3::Item<'w, 's>, P4::Item<'w, 's>, P5::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static, P3::State: Send + Sync + Clone + 'static, P4::State: Send + Sync + Clone + 'static, P5::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker5<P1, P2, P3, P4, P5>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static, P6: SystemParam + 'static> IntoSystem<(FnMarker6<P1, P2, P3, P4, P5, P6>,)> for F
where for<'w, 's> F: FnMut(P1, P2, P3, P4, P5, P6) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>, P3::Item<'w, 's>, P4::Item<'w, 's>, P5::Item<'w, 's>, P6::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static, P3::State: Send + Sync + Clone + 'static, P4::State: Send + Sync + Clone + 'static, P5::State: Send + Sync + Clone + 'static, P6::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker6<P1, P2, P3, P4, P5, P6>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static, P6: SystemParam + 'static, P7: SystemParam + 'static> IntoSystem<(FnMarker7<P1, P2, P3, P4, P5, P6, P7>,)> for F
where for<'w, 's> F: FnMut(P1, P2, P3, P4, P5, P6, P7) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>, P3::Item<'w, 's>, P4::Item<'w, 's>, P5::Item<'w, 's>, P6::Item<'w, 's>, P7::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static, P3::State: Send + Sync + Clone + 'static, P4::State: Send + Sync + Clone + 'static, P5::State: Send + Sync + Clone + 'static, P6::State: Send + Sync + Clone + 'static, P7::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker7<P1, P2, P3, P4, P5, P6, P7>, F>

Source§

impl<F, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static, P6: SystemParam + 'static, P7: SystemParam + 'static, P8: SystemParam + 'static> IntoSystem<(FnMarker8<P1, P2, P3, P4, P5, P6, P7, P8>,)> for F
where for<'w, 's> F: FnMut(P1, P2, P3, P4, P5, P6, P7, P8) + Send + 'static + FnMut(P1::Item<'w, 's>, P2::Item<'w, 's>, P3::Item<'w, 's>, P4::Item<'w, 's>, P5::Item<'w, 's>, P6::Item<'w, 's>, P7::Item<'w, 's>, P8::Item<'w, 's>), P1::State: Send + Sync + Clone + 'static, P2::State: Send + Sync + Clone + 'static, P3::State: Send + Sync + Clone + 'static, P4::State: Send + Sync + Clone + 'static, P5::State: Send + Sync + Clone + 'static, P6::State: Send + Sync + Clone + 'static, P7::State: Send + Sync + Clone + 'static, P8::State: Send + Sync + Clone + 'static,

Source§

type System = FunctionSystem<FnMarker8<P1, P2, P3, P4, P5, P6, P7, P8>, F>

Source§

impl<S: System + 'static> IntoSystem for S