Put template specialization behind a config

This commit is contained in:
Ryan Hunt 2017-07-17 22:56:44 -04:00
parent be9a8f4465
commit 58caa33f09
3 changed files with 7 additions and 1 deletions

View File

@ -100,6 +100,8 @@ rename_args = "[None|GeckoCase|LowerCase|UpperCase|PascalCase|CamelCase|SnakeCas
[struct]
# A rule to use to rename field names
rename_fields = "[None|GeckoCase|LowerCase|UpperCase|PascalCase|CamelCase|SnakeCase|ScreamingSnakeCase|QualifiedScreamingSnakeCase]"
# Whether to generate helper template specialization for generics
generic_template_specialization = true,
# Whether to derive an operator== for all structs
derive_eq = false
# Whether to derive an operator!= for all structs

View File

@ -145,6 +145,8 @@ impl FunctionConfig {
pub struct StructConfig {
/// The rename rule to apply to the name of struct fields
pub rename_fields: Option<RenameRule>,
/// Whether to generate helper template specialization for generics
pub generic_template_specialization: bool,
/// Whether to generate a piecewise equality operator
pub derive_eq: bool,
/// Whether to generate a piecewise inequality operator
@ -163,6 +165,7 @@ impl Default for StructConfig {
fn default() -> StructConfig {
StructConfig {
rename_fields: None,
generic_template_specialization: true,
derive_eq: false,
derive_neq: false,
derive_lt: false,

View File

@ -776,7 +776,8 @@ impl GeneratedBindings {
out.new_line();
}
if self.config.language == Language::Cxx {
if self.config.structure.generic_template_specialization &&
self.config.language == Language::Cxx {
for (path, monomorph_sets) in &self.monomorphs {
if monomorph_sets.len() == 0 {
continue;