@@ -844,7 +844,7 @@ impl WasmModule {
844
844
SectionCode :: Element => ProcessState :: TableElementSection ,
845
845
SectionCode :: Global => ProcessState :: GlobalSection ,
846
846
SectionCode :: Custom { name, kind } => ProcessState :: CustomSection {
847
- name : name. to_vec ( ) ,
847
+ name : Vec :: from ( name. as_bytes ( ) ) ,
848
848
kind,
849
849
} ,
850
850
e => panic ! ( "Have not implemented section code {:?}" , e) ,
@@ -900,8 +900,8 @@ impl WasmModule {
900
900
} => {
901
901
match ty {
902
902
ImportSectionEntryType :: Function ( i) => {
903
- let source = str :: from_utf8 ( module) . unwrap ( ) . to_string ( ) ;
904
- let name = str :: from_utf8 ( field) . unwrap ( ) . to_string ( ) ;
903
+ let source = module. to_string ( ) ;
904
+ let name = field. to_string ( ) ;
905
905
let appended = source. clone ( ) + "_" + & name;
906
906
self . functions . push ( Function :: Imported {
907
907
source,
@@ -912,8 +912,8 @@ impl WasmModule {
912
912
} ) ;
913
913
}
914
914
ImportSectionEntryType :: Global ( global_ty) => {
915
- let source = str :: from_utf8 ( module) . unwrap ( ) . to_string ( ) ;
916
- let name = str :: from_utf8 ( field) . unwrap ( ) . to_string ( ) ;
915
+ let source = module. to_string ( ) ;
916
+ let name = field. to_string ( ) ;
917
917
let appended = source. clone ( ) + "_" + & name;
918
918
919
919
self . globals . push ( Global :: Imported {
@@ -959,7 +959,7 @@ impl WasmModule {
959
959
fn process_export_section ( & mut self , p : & mut Parser ) -> ProcessState {
960
960
match p. read ( ) {
961
961
& ParserState :: ExportSectionEntry { field, kind, index } => {
962
- let name = str :: from_utf8 ( field) . unwrap ( ) . to_string ( ) ;
962
+ let name = field. to_string ( ) ;
963
963
let export = match kind {
964
964
ExternalKind :: Function => Export :: Function {
965
965
name,
0 commit comments