26 lines
664 B
Python
26 lines
664 B
Python
# generates impls for compose tuples
|
|
|
|
|
|
def tp(n):
|
|
return "T" + str(n + 1)
|
|
|
|
def nprint(s):
|
|
print(s, end="")
|
|
|
|
|
|
print("use crate::compose::Compose;")
|
|
print("use crate::output::Output;")
|
|
|
|
for x in range(1, 32):
|
|
nprint("impl<State : Send + Sync,")
|
|
nprint(", ".join([tp(n) + " : Compose<State>" for n in range(0, x)]))
|
|
nprint("> Compose<State> for (")
|
|
nprint("".join([tp(n) + "," for n in range(0, x)]))
|
|
print(") {")
|
|
print("\tfn render(&self, output : &mut impl Output, state : &mut State) {")
|
|
for n in range(0, x):
|
|
nprint("\t\tself.")
|
|
nprint(n)
|
|
print(".render(output, state);")
|
|
print("\t}")
|
|
print("}") |