Add clone

This commit is contained in:
Maik Klein 2018-03-09 23:43:43 +01:00
parent 2c9d4ed71d
commit b622fd7993

View file

@ -140,10 +140,20 @@ pub fn gen_load(feature: &vkxml::Feature, commands: &CommandMap) -> quote::Token
} }
}) })
.collect(); .collect();
let names: Vec<_> = commands.iter().map(|cmd| cmd.command_ident()).collect();
let names_left = &names;
let names_right = &names;
quote!{ quote!{
pub struct #ident { pub struct #ident {
#(#function_pointers,)* #(#function_pointers,)*
} }
impl ::std::clone::Clone for #ident {
pub fn clone(&self) -> Self {
#ident{
#(#names_left: self.#names_right,)*
}
}
}
} }
} }
let version = feature.version_string(); let version = feature.version_string();