Struct walrus::IndicesToIds
source · pub struct IndicesToIds { /* private fields */ }
Expand description
Maps from old indices in the original Wasm binary to walrus
IDs.
This is intended to be used with walrus::Module
s that were parsed from
some existing Wasm binary. walrus::Module
s that are built up from scratch,
and not originally parsed from an existing Wasm binary, will have an empty
IndicesToIds
.
For example, this allows you to get the walrus::FunctionId
of some Wasm
function when you have its old index in the original Wasm module.
Any newly built or added things (functions, tables, types, etc) are not associated with an old index (since they were not present in the original Wasm binary).
Implementations§
source§impl IndicesToIds
impl IndicesToIds
source§impl IndicesToIds
impl IndicesToIds
source§impl IndicesToIds
impl IndicesToIds
sourcepub fn get_func(&self, index: u32) -> Result<FunctionId>
pub fn get_func(&self, index: u32) -> Result<FunctionId>
Gets the ID for a particular index.
If the index did not exist in the original Wasm binary, an Err
is returned.
source§impl IndicesToIds
impl IndicesToIds
sourcepub fn get_global(&self, index: u32) -> Result<GlobalId>
pub fn get_global(&self, index: u32) -> Result<GlobalId>
Gets the ID for a particular index.
If the index did not exist in the original Wasm binary, an Err
is returned.
source§impl IndicesToIds
impl IndicesToIds
sourcepub fn get_memory(&self, index: u32) -> Result<MemoryId>
pub fn get_memory(&self, index: u32) -> Result<MemoryId>
Gets the ID for a particular index.
If the index did not exist in the original Wasm binary, an Err
is returned.
source§impl IndicesToIds
impl IndicesToIds
sourcepub fn get_element(&self, index: u32) -> Result<ElementId>
pub fn get_element(&self, index: u32) -> Result<ElementId>
Gets the ID for a particular index.
If the index did not exist in the original Wasm binary, an Err
is returned.