#![allow(dead_code)] use typle::typle; pub struct MyStruct { t: T, } #[typle(Tuple for 3..=3)] impl> MyStruct { pub fn test_macro(&self) -> u32 { let typle_for!(i in 0..2 => x::): typle_for!(i in 0..2 => T<{i}>) = typle_for!(i in 0..2 => self.t[[i]] * 3); x0 + x1 } pub fn component(&self) -> u32 { let x::: T<1> = self.t.1; x1 } pub fn test_slice(&self) -> u32 { let [x0, x1] = typle_for![i in 0..2 => self.t[[i]] * 3]; x0 + x1 } pub fn test_tuple(&self) -> u32 { let (x0, x1) = typle_for!(i in 0..2 => self.t[[i]] * 3); x0 + x1 } } #[typle(Tuple for 1..=12)] fn multiply_by>(t: T, m: u32) -> T { // let (x0, x1, x2) = (t.0 * m, t.1 * m, t.2 * m); let typle_for!(i in .. => x::) = typle_for!(i in .. => t[[i]] * m); assert_eq!(x0, t.0 * m); typle_for!(i in .. => x::) }