pub struct SourceMap {
    pub module_name_opt: Option<(AccountAddress, Identifier)>,
    pub constant_map: BTreeMap<ConstantName, TableIndex>,
    /* private fields */
}

Fields§

§module_name_opt: Option<(AccountAddress, Identifier)>

The name <address.module_name> for module that this source map is for None if it is a script

§constant_map: BTreeMap<ConstantName, TableIndex>

Implementations§

source§

impl SourceMap

source

pub fn new(module_name_opt: Option<ModuleIdent>) -> Self

source

pub fn add_top_level_function_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, location: Loc ) -> Result<()>

source

pub fn add_function_type_parameter_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, name: SourceName ) -> Result<()>

source

pub fn get_function_type_parameter_name( &self, fdef_idx: FunctionDefinitionIndex, type_parameter_idx: usize ) -> Result<SourceName>

source

pub fn add_code_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, start_offset: CodeOffset, location: Loc ) -> Result<()>

source

pub fn add_nop_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, label: NopLabel, start_offset: CodeOffset ) -> Result<()>

source

pub fn get_code_location( &self, fdef_idx: FunctionDefinitionIndex, offset: CodeOffset ) -> Result<Loc>

Given a function definition and a code offset within that function definition, this returns the location in the source code associated with the instruction at that offset.

source

pub fn add_local_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, name: SourceName ) -> Result<()>

source

pub fn add_parameter_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, name: SourceName ) -> Result<()>

source

pub fn get_parameter_or_local_name( &self, fdef_idx: FunctionDefinitionIndex, index: u64 ) -> Result<SourceName>

source

pub fn add_top_level_struct_mapping( &mut self, struct_def_idx: StructDefinitionIndex, location: Loc ) -> Result<()>

source

pub fn add_const_mapping( &mut self, const_idx: ConstantPoolIndex, name: ConstantName ) -> Result<()>

source

pub fn add_struct_field_mapping( &mut self, struct_def_idx: StructDefinitionIndex, location: Loc ) -> Result<()>

source

pub fn get_struct_field_name( &self, struct_def_idx: StructDefinitionIndex, field_idx: MemberCount ) -> Option<Loc>

source

pub fn add_struct_type_parameter_mapping( &mut self, struct_def_idx: StructDefinitionIndex, name: SourceName ) -> Result<()>

source

pub fn get_struct_type_parameter_name( &self, struct_def_idx: StructDefinitionIndex, type_parameter_idx: usize ) -> Result<SourceName>

source

pub fn get_function_source_map( &self, fdef_idx: FunctionDefinitionIndex ) -> Result<&FunctionSourceMap>

source

pub fn get_struct_source_map( &self, struct_def_idx: StructDefinitionIndex ) -> Result<&StructSourceMap>

source

pub fn dummy_from_view( view: &BinaryIndexedView<'_>, default_loc: Loc ) -> Result<Self>

Create a ‘dummy’ source map for a compiled module or script. This is useful for e.g. disassembling with generated or real names depending upon if the source map is available or not.

Trait Implementations§

source§

impl Clone for SourceMap

source§

fn clone(&self) -> SourceMap

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SourceMap

source§

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

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

impl<'de> Deserialize<'de> for SourceMap

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for SourceMap

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,