Reads exactly `dst.len()` bytes from memory.
(&self, store: &Store, offset: usize, dst: &mut [u8])
| 226 | |
| 227 | /// Reads exactly `dst.len()` bytes from memory. |
| 228 | pub fn read_exact(&self, store: &Store, offset: usize, dst: &mut [u8]) -> Result<()> { |
| 229 | self.instance(store)?.inner.read_exact(offset, dst).ok_or_else(|| { |
| 230 | Error::Trap(crate::Trap::MemoryOutOfBounds { |
| 231 | offset, |
| 232 | len: dst.len(), |
| 233 | max: self.instance(store).unwrap().inner.len(), |
| 234 | }) |
| 235 | }) |
| 236 | } |
| 237 | |
| 238 | /// Reads `len` bytes from memory into a newly allocated buffer. |
| 239 | pub fn read_vec(&self, store: &Store, offset: usize, len: usize) -> Result<Vec<u8>> { |