wasi_assembler/helpers/
mod.rs1#![doc = include_str!("readme.md")]
2
3use crate::program::WasiProgram;
4
5pub fn is_valid_function_name(name: &str) -> bool {
7 !name.is_empty() && name.chars().all(|c| c.is_alphanumeric() || c == '_')
8}
9
10pub fn rust_type_to_wasm_type<T>() -> crate::program::WasmValueType {
12 crate::program::WasmValueType::I32 }
14
15pub fn encode_leb128(value: u64) -> Vec<u8> {
17 let mut buf = Vec::new();
18 leb128::write::unsigned(&mut buf, value).unwrap();
19 buf
20}
21
22pub fn create_sample_module() -> WasiProgram {
24 WasiProgram::new_core_module()
25}
26
27pub fn validate_module_structure(_program: &WasiProgram) -> bool {
29 true
30}