Skip to content

Commit

Permalink
Adds generate_all and disable_custom_section_link_helpers to `Bin…
Browse files Browse the repository at this point in the history
…dings` (#336)
  • Loading branch information
primoly authored Oct 9, 2024
1 parent faf251f commit abe22dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,14 @@ impl<'a> BindingsGenerator<'a> {
.iter()
.map(|(key, value)| (key.clone(), WithOption::Path(value.clone())))
.collect(),
generate_all: settings.generate_all,
type_section_suffix: settings.type_section_suffix.clone(),
disable_run_ctors_once_workaround: settings.disable_run_ctors_once_workaround,
default_bindings_module: settings.default_bindings_module.clone(),
export_macro_name: settings.export_macro_name.clone(),
pub_export_macro: settings.pub_export_macro,
generate_unused_types: settings.generate_unused_types,
// todo - add support for these settings
generate_all: true,
disable_custom_section_link_helpers: false,
disable_custom_section_link_helpers: settings.disable_custom_section_link_helpers,
};

let mut files = Files::default();
Expand Down
11 changes: 11 additions & 0 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub struct Bindings {
pub export_prefix: Option<String>,
/// Remapping of interface names to rust module names.
pub with: HashMap<String, String>,
/// Indicates that all interfaces not specified in `with` should be
/// generated.
pub generate_all: bool,
/// Add the specified suffix to the name of the custome section containing
/// the component type.
pub type_section_suffix: Option<String>,
Expand All @@ -101,6 +104,12 @@ pub struct Bindings {
pub pub_export_macro: bool,
/// Whether to generate unused structures, not generated by default (false)
pub generate_unused_types: bool,
/// Whether or not to generate helper function/constants to help link custom
/// sections into the final output.
///
/// Disabling this can shave a few bytes off a binary but makes
/// library-based usage of `generate!` prone to breakage.
pub disable_custom_section_link_helpers: bool,
}

impl Default for Bindings {
Expand All @@ -115,12 +124,14 @@ impl Default for Bindings {
stubs: Default::default(),
export_prefix: Default::default(),
with: Default::default(),
generate_all: true,
type_section_suffix: Default::default(),
disable_run_ctors_once_workaround: Default::default(),
default_bindings_module: Default::default(),
export_macro_name: Default::default(),
pub_export_macro: Default::default(),
generate_unused_types: Default::default(),
disable_custom_section_link_helpers: Default::default(),
}
}
}
Expand Down

0 comments on commit abe22dc

Please sign in to comment.