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§
Required Methods§
Sourcefn into_system(self) -> BoxedSystem
fn into_system(self) -> BoxedSystem
Converts this into a system.