#![allow(unused)] use typle::typle; #[typle(Tuple for 0..=3)] fn append(t: T, a: A) -> (T<{ .. }>, A) { (t[[..]], a) } #[typle(Tuple for 1..=3)] fn append_array>(t: T, a: bool) -> [bool; T::LEN + 1] { [t[[..]], a] } #[typle(Tuple for 1..=3)] fn append_double>(t: T, a: u32) -> [u32; T::LEN + 1] { [typle_args!(i in .. => 2 * t[[i]]), 2 * a] } #[typle(Tuple for 0..=3)] fn append_even(t: T, a: u32) -> (typle_args!(i in .. => if i % 2 == 0 {T<{i}>}), u32) { (typle_args!(i in .. => if i % 2 == 0 {t[[i]]}), a) } #[typle(Tuple for 0..=3)] fn even_string_odd( t: T, ) -> (typle_args!(i in .. => if i % 2 == 0 {String} else {T<{i}>}),) where typle_bound!(i in .. => if i % 2 == 0 {T<{i}>}): ToString, { #[typle_attr_if(T::LEN == 0, allow(clippy::unused_unit))] (typle_args!(i in .. => if i % 2 == 0 {t[[i]].to_string()} else {t[[i]]}),) } struct World {} trait ExclusiveSystemParam {} struct ExclusiveSystemParamItem { f: F, } trait ExclusiveSystemParamFunction { type In; type Out; type Param; fn run( &mut self, world: &mut World, _in: Self::In, param_value: ExclusiveSystemParamItem, ) -> Self::Out; } // https://github.com/jongiddy/bevy/blob/ac91b191/crates/bevy_ecs/src/system/exclusive_function_system.rs#L183 #[typle(Tuple for 0..=3)] impl ExclusiveSystemParamFunction) -> Out> for Func where for<'a> &'a mut Func: FnMut(&mut World, F<{ .. }>) -> Out + FnMut(&mut World, typle_args!(i in .. => ExclusiveSystemParamItem>)) -> Out, Out: 'static, F<_>: ExclusiveSystemParam, { type In = (); type Out = Out; type Param = F; #[inline] fn run( &mut self, world: &mut World, _in: (), param_value: ExclusiveSystemParamItem, ) -> Self::Out { todo!() } }