@ -85,12 +85,6 @@ struct CargoWasmPackProfiles {
deserialize_with = "CargoWasmPackProfile::deserialize_profiling"
) ]
profiling : CargoWasmPackProfile ,
#[ serde(
default = "CargoWasmPackProfile::default_custom" ,
deserialize_with = "CargoWasmPackProfile::deserialize_custom"
) ]
custom : CargoWasmPackProfile ,
}
impl Default for CargoWasmPackProfiles {
@ -99,7 +93,6 @@ impl Default for CargoWasmPackProfiles {
dev : CargoWasmPackProfile ::default_dev ( ) ,
release : CargoWasmPackProfile ::default_release ( ) ,
profiling : CargoWasmPackProfile ::default_profiling ( ) ,
custom : CargoWasmPackProfile ::default_custom ( ) ,
}
}
}
@ -127,9 +120,6 @@ struct CargoWasmPackProfileWasmBindgen {
#[ serde(default, rename = " omit-default-module-path " ) ]
omit_default_module_path : Option < bool > ,
#[ serde(default, rename = " split-linked-modules " ) ]
split_linked_modules : Option < bool > ,
}
/// Struct for storing information received from crates.io
@ -286,7 +276,6 @@ impl CargoWasmPackProfile {
demangle_name_section : Some ( true ) ,
dwarf_debug_info : Some ( false ) ,
omit_default_module_path : Some ( false ) ,
split_linked_modules : Some ( false ) ,
} ,
wasm_opt : None ,
}
@ -299,7 +288,6 @@ impl CargoWasmPackProfile {
demangle_name_section : Some ( true ) ,
dwarf_debug_info : Some ( false ) ,
omit_default_module_path : Some ( false ) ,
split_linked_modules : Some ( false ) ,
} ,
wasm_opt : Some ( CargoWasmPackProfileWasmOpt ::Enabled ( true ) ) ,
}
@ -312,20 +300,6 @@ impl CargoWasmPackProfile {
demangle_name_section : Some ( true ) ,
dwarf_debug_info : Some ( false ) ,
omit_default_module_path : Some ( false ) ,
split_linked_modules : Some ( false ) ,
} ,
wasm_opt : Some ( CargoWasmPackProfileWasmOpt ::Enabled ( true ) ) ,
}
}
fn default_custom ( ) -> Self {
CargoWasmPackProfile {
wasm_bindgen : CargoWasmPackProfileWasmBindgen {
debug_js_glue : Some ( false ) ,
demangle_name_section : Some ( true ) ,
dwarf_debug_info : Some ( false ) ,
omit_default_module_path : Some ( false ) ,
split_linked_modules : Some ( false ) ,
} ,
wasm_opt : Some ( CargoWasmPackProfileWasmOpt ::Enabled ( true ) ) ,
}
@ -358,15 +332,6 @@ impl CargoWasmPackProfile {
Ok ( profile )
}
fn deserialize_custom < ' de , D > ( deserializer : D ) -> Result < Self , D ::Error >
where
D : serde ::Deserializer < ' de > ,
{
let mut profile = < Option < Self > > ::deserialize ( deserializer ) ? . unwrap_or_default ( ) ;
profile . update_with_defaults ( & Self ::default_custom ( ) ) ;
Ok ( profile )
}
fn update_with_defaults ( & mut self , defaults : & Self ) {
macro_rules! d {
( $( $path :ident ) . * ) = > {
@ -377,7 +342,6 @@ impl CargoWasmPackProfile {
d ! ( wasm_bindgen . demangle_name_section ) ;
d ! ( wasm_bindgen . dwarf_debug_info ) ;
d ! ( wasm_bindgen . omit_default_module_path ) ;
d ! ( wasm_bindgen . split_linked_modules ) ;
if self . wasm_opt . is_none ( ) {
self . wasm_opt = defaults . wasm_opt . clone ( ) ;
@ -404,11 +368,6 @@ impl CargoWasmPackProfile {
self . wasm_bindgen . omit_default_module_path . unwrap ( )
}
/// Get this profile's configured `[wasm-bindgen.split-linked-modules]` value.
pub fn wasm_bindgen_split_linked_modules ( & self ) -> bool {
self . wasm_bindgen . split_linked_modules . unwrap ( )
}
/// Get this profile's configured arguments for `wasm-opt`, if enabled.
pub fn wasm_opt_args ( & self ) -> Option < Vec < String > > {
match self . wasm_opt . as_ref ( ) ? {
@ -531,7 +490,6 @@ impl CrateData {
BuildProfile ::Dev = > & self . manifest . package . metadata . wasm_pack . profile . dev ,
BuildProfile ::Profiling = > & self . manifest . package . metadata . wasm_pack . profile . profiling ,
BuildProfile ::Release = > & self . manifest . package . metadata . wasm_pack . profile . release ,
BuildProfile ::Custom ( _ ) = > & self . manifest . package . metadata . wasm_pack . profile . custom ,
}
}