Add a doc explanation to each swizzle function.

This commit is contained in:
Egor Larionov 2017-09-30 16:37:07 -07:00
parent b700a8db59
commit 768b6b71f0

View file

@ -32,10 +32,12 @@ fn gen_swizzle_functions(variables: &'static str, upto: usize) -> String {
let nn = (variables.len()+1).pow(upto as u32); let nn = (variables.len()+1).pow(upto as u32);
for i in 1..nn { for i in 1..nn {
if let Some((swizzle_name, swizzle_impl)) = gen_swizzle_nth(variables, i, upto) { if let Some((swizzle_name, swizzle_impl)) = gen_swizzle_nth(variables, i, upto) {
let vec_type = format!("$vector_type{}", swizzle_name.len()); let dim = format!("{}", swizzle_name.len());
result.push_str( result.push_str(
&format!(" #[inline] pub fn {0}(&self) -> {2}<$S> {{ {2}::new({1}) }}\n", &format!("
swizzle_name, swizzle_impl, vec_type)); /// Swizzle operator that creates a new type with dimension {2} from variables `{0}`.
#[inline] pub fn {0}(&self) -> $vector_type{2}<$S> {{ $vector_type{2}::new({1}) }}\n",
swizzle_name, swizzle_impl, dim));
} }
} }
result result