| 176 | |
| 177 | #[cfg(feature = "std")] |
| 178 | fn read_more(stream: &mut impl std::io::Read, buffer: &mut alloc::vec::Vec<u8>, hint: usize) -> Result<usize> { |
| 179 | let len = buffer.len(); |
| 180 | buffer.extend((0..hint).map(|_| 0u8)); |
| 181 | let read_bytes = stream |
| 182 | .read(&mut buffer[len..]) |
| 183 | .map_err(|e| ParseError::Other(alloc::format!("Error reading from stream: {e}")))?; |
| 184 | buffer.truncate(len + read_bytes); |
| 185 | Ok(read_bytes) |
| 186 | } |
| 187 | |
| 188 | /// Parse a [`Module`] from bytes |
| 189 | pub fn parse_module_bytes(&self, wasm: impl AsRef<[u8]>) -> Result<Module> { |