diff --git a/codegen/templates/swizzle_traits.rs.tera b/codegen/templates/swizzle_traits.rs.tera index 0bc3ae57..83cf225f 100644 --- a/codegen/templates/swizzle_traits.rs.tera +++ b/codegen/templates/swizzle_traits.rs.tera @@ -3,16 +3,16 @@ {% set components = ["x", "y", "z", "w"] %} {% set dimensions = [2, 3, 4] %} {% for dim in dimensions %} - {% set ret2 = "Self::Vec2" %} - {% set ret3 = "Self::Vec3" %} - {% set ret4 = "Self::Vec4" %} + {% set vec2_t = "Self::Vec2" %} + {% set vec3_t = "Self::Vec3" %} + {% set vec4_t = "Self::Vec4" %} {% if dim == 4 %} - {% set ret4 = "Self" %} + {% set vec4_t = "Self" %} {% elif dim == 3 %} - {% set ret3 = "Self" %} + {% set vec3_t = "Self" %} {% elif dim == 2 %} - {% set ret2 = "Self" %} + {% set vec2_t = "Self" %} {% endif %} pub trait Vec{{ dim }}Swizzles: Sized + Copy + Clone { @@ -52,28 +52,28 @@ {% if i == 2 %} {% set skip = dim == 2 and e0 == "x" and e1 == "y" %} {% if not skip %} - fn {{e0}}{{e1}}(self) -> {{ret2}}; + fn {{e0}}{{e1}}(self) -> {{ vec2_t }}; {% endif %} {% set skip = dim == 2 or e0 == e1 %} {% if not skip %} - fn with_{{e0}}{{e1}}(self, rhs: {{ret2}}) -> Self; + fn with_{{e0}}{{e1}}(self, rhs: {{ vec2_t }}) -> Self; {% endif %} {% else %} {% for e2 in components | slice(end=dim) %} {% if i == 3 %} {% set skip = dim == 3 and e0 == "x" and e1 == "y" and e2 == "z" %} {% if not skip %} - fn {{e0}}{{e1}}{{e2}}(self) -> {{ret3}}; + fn {{e0}}{{e1}}{{e2}}(self) -> {{ vec3_t }}; {% endif %} {% set skip = dim == 3 or e0 == e1 or e0 == e2 or e1 == e2 %} {% if not skip %} - fn with_{{e0}}{{e1}}{{e2}}(self, rhs: {{ret3}}) -> Self; + fn with_{{e0}}{{e1}}{{e2}}(self, rhs: {{ vec3_t }}) -> Self; {% endif %} {% else %} {% for e3 in components | slice(end=dim) %} {% set skip = dim == 4 and e0 == "x" and e1 == "y" and e2 == "z" and e3 == "w" %} {% if not skip %} - fn {{e0}}{{e1}}{{e2}}{{e3}}(self) -> {{ret4}}; + fn {{e0}}{{e1}}{{e2}}{{e3}}(self) -> {{ vec4_t }}; {% endif %} {% endfor %} {% endif %}