use bevy_simplified::*; struct Timer(usize); impl Resource for Timer {} fn run_timer(_: Timer) { /* ... */ } fn main() { App::new() .insert_resource(Timer(0)) .add_system(run_timer) .run(); } mod bevy_simplified { use std::marker::PhantomData; pub struct App {} impl App { pub fn new() -> Self { App {} } pub fn insert_resource(self, r: T) -> Self { self } pub fn add_system(self, _: impl IntoSystemConfig) -> Self { self } pub fn run(self) { } } // General Stuff pub trait Resource {} pub struct TheWorld {} pub struct Res { _marker: PhantomData, } pub trait SystemParam {} impl SystemParam for Res {} impl SystemParam for (T,) {} pub trait System { type In; type Out; } pub trait IntoSystemConfig {} pub trait IntoSystem { type System: System; } // Exclusive system stuff pub trait ExclusiveSystemParam {} impl ExclusiveSystemParam for (&mut TheWorld,) {} pub struct IsExclusiveFunctionSystem; pub trait ExclusiveSystemParamFunction { type In; type Out; type Param: ExclusiveSystemParam; } pub struct ExclusiveFunctionSystem where F: ExclusiveSystemParamFunction, { g0: PhantomData, g1: PhantomData, } impl IntoSystem for F where F: ExclusiveSystemParamFunction, { type System = ExclusiveFunctionSystem; } // Normal system stuff pub trait SystemParamFunction { type In; type Out; type Param: SystemParam; } pub struct IsFunctionSystem; pub struct FunctionSystem where F: SystemParamFunction, { g0: PhantomData, g1: PhantomData, } impl IntoSystemConfig for F where F: IntoSystem<(), (), Marker> {} impl IntoSystem for F where F: SystemParamFunction, { type System = FunctionSystem; } impl System for ExclusiveFunctionSystem where F: ExclusiveSystemParamFunction, { type In = F::In; type Out = F::Out; } impl System for FunctionSystem where F: SystemParamFunction, { type In = F::In; type Out = F::Out; } impl SystemParamFunction Out> for Func where F0: SystemParam, // Remove the below constraint to get the funky error message "cannot infer type for F0" Func: FnMut(F0) -> Out, { type In = (); type Out = Out; type Param = (F0,); } impl<'a, Func, Out> ExclusiveSystemParamFunction Out> for Func where Func: FnMut(&mut TheWorld) -> Out, { type In = (); type Out = Out; type Param = (&'a mut TheWorld,); } }