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::Modules that were parsed from some existing Wasm binary. walrus::Modules 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

source

pub fn get_table(&self, index: u32) -> Result<TableId>

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

source

pub fn get_type(&self, index: u32) -> Result<TypeId>

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

source

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

source

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

source

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

source

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.

source§

impl IndicesToIds

source

pub fn get_data(&self, index: u32) -> Result<DataId>

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

source

pub fn get_local(&self, function: FunctionId, index: u32) -> Result<LocalId>

Gets the ID for a particular index

Trait Implementations§

source§

impl Debug for IndicesToIds

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for IndicesToIds

source§

fn default() -> IndicesToIds

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.