use crate::{EntityRef, FuncIndex, SignatureIndex};
const FUNCTION_PREFIX: &str = "_wasm_function_";
const TRAMPOLINE_PREFIX: &str = "_trampoline_";
pub fn func_symbol_name(index: FuncIndex) -> String {
format!("{}{}", FUNCTION_PREFIX, index.index())
}
pub fn try_parse_func_name(name: &str) -> Option<FuncIndex> {
let n = name.strip_prefix(FUNCTION_PREFIX)?.parse().ok()?;
Some(FuncIndex::new(n))
}
pub fn trampoline_symbol_name(index: SignatureIndex) -> String {
format!("{}{}", TRAMPOLINE_PREFIX, index.index())
}
pub fn try_parse_trampoline_name(name: &str) -> Option<SignatureIndex> {
let n = name.strip_prefix(TRAMPOLINE_PREFIX)?.parse().ok()?;
Some(SignatureIndex::new(n))
}