Returns a summary of the resources required to instantiate this [`Module`]. Potential uses of the returned information: Determining whether your pooling allocator configuration supports instantiating this module. Deciding how many of which `Module` you want to instantiate within a fixed amount of resources, e.g. determining whether to create 5 instances of module X or 10 instances of module Y.
(&self)
| 963 | /// # Ok(()) } |
| 964 | /// ``` |
| 965 | pub fn resources_required(&self) -> ResourcesRequired { |
| 966 | let em = self.env_module(); |
| 967 | let num_memories = u32::try_from(em.num_defined_memories()).unwrap(); |
| 968 | let max_initial_memory_size = em |
| 969 | .memories |
| 970 | .values() |
| 971 | .skip(em.num_imported_memories) |
| 972 | .map(|memory| memory.limits.min) |
| 973 | .max(); |
| 974 | let num_tables = u32::try_from(em.num_defined_tables()).unwrap(); |
| 975 | let max_initial_table_size = em |
| 976 | .tables |
| 977 | .values() |
| 978 | .skip(em.num_imported_tables) |
| 979 | .map(|table| table.limits.min) |
| 980 | .max(); |
| 981 | ResourcesRequired { |
| 982 | num_memories, |
| 983 | max_initial_memory_size, |
| 984 | num_tables, |
| 985 | max_initial_table_size, |
| 986 | } |
| 987 | } |
| 988 | |
| 989 | /// Returns the range of bytes in memory where this module's compilation |
| 990 | /// image resides. |
nothing calls this directly
no test coverage detected