@@ -376,7 +376,7 @@ impl Module {
376376 /// # fn main() -> anyhow::Result<()> {
377377 /// # let store = Store::default();
378378 /// let module = Module::new(&store, "(module)")?;
379- /// assert_eq!(module.num_imports (), 0);
379+ /// assert_eq!(module.imports().len (), 0);
380380 /// # Ok(())
381381 /// # }
382382 /// ```
@@ -393,7 +393,7 @@ impl Module {
393393 /// )
394394 /// "#;
395395 /// let module = Module::new(&store, wat)?;
396- /// assert_eq!(module.num_imports (), 1);
396+ /// assert_eq!(module.imports().len (), 1);
397397 /// let import = module.imports().next().unwrap();
398398 /// assert_eq!(import.module, "host");
399399 /// assert_eq!(import.name, "foo");
@@ -404,7 +404,7 @@ impl Module {
404404 /// # Ok(())
405405 /// # }
406406 /// ```
407- pub fn imports < ' me > ( & ' me self ) -> impl Iterator < Item = ImportType > + ' me {
407+ pub fn imports < ' me > ( & ' me self ) -> impl ExactSizeIterator < Item = ImportType > + ' me {
408408 let module = self . inner . compiled . module_ref ( ) ;
409409 module
410410 . imports
@@ -419,11 +419,6 @@ impl Module {
419419 } )
420420 }
421421
422- /// Return the number of imports in this module.
423- pub fn num_imports ( & self ) -> usize {
424- self . inner . compiled . module_ref ( ) . imports . len ( )
425- }
426-
427422 /// Returns the list of exports that this [`Module`] has and will be
428423 /// available after instantiation.
429424 ///
@@ -459,7 +454,7 @@ impl Module {
459454 /// )
460455 /// "#;
461456 /// let module = Module::new(&store, wat)?;
462- /// assert_eq!(module.num_exports (), 2);
457+ /// assert_eq!(module.exports().len (), 2);
463458 ///
464459 /// let foo = module.exports().next().unwrap();
465460 /// assert_eq!(foo.name, "foo");
@@ -477,7 +472,7 @@ impl Module {
477472 /// # Ok(())
478473 /// # }
479474 /// ```
480- pub fn exports < ' me > ( & ' me self ) -> impl Iterator < Item = ExportType > + ' me {
475+ pub fn exports < ' me > ( & ' me self ) -> impl ExactSizeIterator < Item = ExportType > + ' me {
481476 let module = self . inner . compiled . module_ref ( ) ;
482477 module. exports . iter ( ) . map ( move |( name, entity_index) | {
483478 let r#type = entity_type ( entity_index, module) ;
@@ -488,11 +483,6 @@ impl Module {
488483 } )
489484 }
490485
491- /// Return the number of exports in this module.
492- pub fn num_exports ( & self ) -> usize {
493- self . inner . compiled . module_ref ( ) . exports . len ( )
494- }
495-
496486 /// Returns the [`Store`] that this [`Module`] was compiled into.
497487 pub fn store ( & self ) -> & Store {
498488 & self . inner . store
0 commit comments