mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
wasm: self-review edits
This commit is contained in:
parent
4300ef8b47
commit
11c1c92cc1
3 changed files with 17 additions and 22 deletions
|
@ -13,12 +13,6 @@ pub struct ParseError {
|
|||
pub message: String,
|
||||
}
|
||||
|
||||
/// Skip over serialized bytes for a type
|
||||
/// This may, or may not, require looking at the byte values
|
||||
pub trait SkipBytes: Sized {
|
||||
fn skip_bytes(bytes: &[u8], cursor: &mut usize) -> Result<(), ParseError>;
|
||||
}
|
||||
|
||||
/// Decode an unsigned 32-bit integer from the provided buffer in LEB-128 format
|
||||
/// Return the integer itself and the offset after it ends
|
||||
fn decode_u32(bytes: &[u8]) -> Result<(u32, usize), ()> {
|
||||
|
@ -64,6 +58,12 @@ impl<'a> Parse<&'a Bump> for &'a str {
|
|||
}
|
||||
}
|
||||
|
||||
/// Skip over serialized bytes for a type
|
||||
/// This may, or may not, require looking at the byte values
|
||||
pub trait SkipBytes: Sized {
|
||||
fn skip_bytes(bytes: &[u8], cursor: &mut usize) -> Result<(), ParseError>;
|
||||
}
|
||||
|
||||
impl SkipBytes for u32 {
|
||||
fn skip_bytes(bytes: &[u8], cursor: &mut usize) -> Result<(), ParseError> {
|
||||
const MAX_LEN: usize = 5;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue