Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds generate_all and disable_custom_section_link_helpers to Bindings #336

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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