MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / read_more

Method read_more

crates/parser/src/lib.rs:178–186  ·  view source on GitHub ↗
(stream: &mut impl std::io::Read, buffer: &mut alloc::vec::Vec<u8>, hint: usize)

Source from the content-addressed store, hash-verified

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> {

Callers

nothing calls this directly

Calls 3

mapMethod · 0.80
lenMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected