mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
wasm: store Imports in deserialized form for easier manipulation
This commit is contained in:
parent
0900481ec8
commit
b4e139a799
5 changed files with 144 additions and 66 deletions
|
@ -47,6 +47,14 @@ impl Parse<()> for u32 {
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse<()> for u8 {
|
||||
fn parse(_ctx: (), bytes: &[u8], cursor: &mut usize) -> Result<Self, ParseError> {
|
||||
let byte = bytes[*cursor];
|
||||
*cursor += 1;
|
||||
Ok(byte)
|
||||
}
|
||||
}
|
||||
|
||||
/// Decode a signed 32-bit integer from the provided buffer in LEB-128 format
|
||||
/// Return the integer itself and the offset after it ends
|
||||
fn decode_i32(bytes: &[u8]) -> Result<(i32, usize), ()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue