wadec 0.0.1

A library for decoding WebAssembly modules.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::core::types::memtype::MemType;
use crate::decode::types::limits::{ParseLimitsError, parse_limits};
use std::io::Read;
use thiserror::Error;

#[derive(Debug, Error)]
#[error("failed decoding Memory type")]
pub struct DecodeMemoryTypeError(#[from] pub ParseLimitsError);

pub(crate) fn parse_memtype<R: Read + ?Sized>(
    reader: &mut R,
) -> Result<MemType, DecodeMemoryTypeError> {
    let limits = parse_limits(reader)?;
    Ok(MemType { limits })
}