From 768b6b71f05ff21b57eb3dbcda58f2734a4a4ab4 Mon Sep 17 00:00:00 2001 From: Egor Larionov Date: Sat, 30 Sep 2017 16:37:07 -0700 Subject: [PATCH] Add a doc explanation to each swizzle function. --- build.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index f3c7648..42e5d0b 100644 --- a/build.rs +++ b/build.rs @@ -32,10 +32,12 @@ fn gen_swizzle_functions(variables: &'static str, upto: usize) -> String { let nn = (variables.len()+1).pow(upto as u32); for i in 1..nn { 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( - &format!(" #[inline] pub fn {0}(&self) -> {2}<$S> {{ {2}::new({1}) }}\n", - swizzle_name, swizzle_impl, vec_type)); + &format!(" + /// 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