Struct move_model::model::ModuleEnv

source ·
pub struct ModuleEnv<'env> {
    pub env: &'env GlobalEnv,
    /* private fields */
}
Expand description

Represents a module environment.

Fields§

§env: &'env GlobalEnv

Reference to the outer env.

Implementations§

source§

impl<'env> ModuleEnv<'env>

source

pub fn get_id(&self) -> ModuleId

Returns the id of this module in the global env.

source

pub fn get_name(&'env self) -> &'env ModuleName

Returns the name of this module.

source

pub fn matches_name(&self, name: &str) -> bool

Returns true if either the full name or simple name of this module matches the given string

source

pub fn get_loc(&'env self) -> Loc

Returns the location of this module.

source

pub fn get_full_name_str(&self) -> String

Returns full name as a string.

source

pub fn get_identifier(&'env self) -> Identifier

Returns the VM identifier for this module

source

pub fn is_script_module(&self) -> bool

Returns true if this is a module representing a script.

source

pub fn is_target(&self) -> bool

Returns true of this module is target of compilation. A non-target module is a dependency only but not explicitly requested to process.

source

pub fn get_source_path(&self) -> &OsStr

Returns the path to source file of this module.

source

pub fn get_dependencies(&self) -> Vec<ModuleId>

Return the set of language storage ModuleId’s that this module’s bytecode depends on (including itself), friend modules are excluded from the return result.

source

pub fn get_friends(&self) -> Vec<ModuleId>

Return the set of language storage ModuleId’s that this module declares as friends

source

pub fn get_using_modules(&self, include_specs: bool) -> BTreeSet<ModuleId>

Returns the set of modules that use this one.

source

pub fn get_used_modules(&self, include_specs: bool) -> BTreeSet<ModuleId>

Returns the set of modules this one uses.

source

pub fn get_friend_modules(&self) -> BTreeSet<ModuleId>

Returns the set of modules this one declares as friends.

source

pub fn is_transitive_dependency(&self, module_id: ModuleId) -> bool

Returns true if the given module is a transitive dependency of this one. The transitive dependency set contains this module and all directly or indirectly used modules (without spec usage).

source

pub fn get_doc(&self) -> &str

Returns documentation associated with this module.

source

pub fn get_spec_block_infos(&self) -> &[SpecBlockInfo]

Returns spec block documentation infos.

source

pub fn symbol_pool(&self) -> &SymbolPool

Shortcut for accessing the symbol pool.

source

pub fn get_verified_module(&'env self) -> &'env CompiledModule

Gets the underlying bytecode module.

source

pub fn find_named_constant( &'env self, name: Symbol ) -> Option<NamedConstantEnv<'env>>

Gets a NamedConstantEnv in this module by name

source

pub fn get_named_constant( &'env self, id: NamedConstantId ) -> NamedConstantEnv<'env>

Gets a NamedConstantEnv in this module by the constant’s id

source

pub fn into_named_constant(self, id: NamedConstantId) -> NamedConstantEnv<'env>

Gets a NamedConstantEnv by id

source

pub fn get_named_constant_count(&self) -> usize

Gets the number of named constants in this module.

source

pub fn get_named_constants( &'env self ) -> impl Iterator<Item = NamedConstantEnv<'env>>

Returns iterator over NamedConstantEnvs in this module.

source

pub fn into_named_constants( self ) -> impl Iterator<Item = NamedConstantEnv<'env>>

Returns an iterator over NamedConstantEnvs in this module.

source

pub fn find_function(&self, name: Symbol) -> Option<FunctionEnv<'env>>

Gets a FunctionEnv in this module by name.

source

pub fn get_function(&'env self, id: FunId) -> FunctionEnv<'env>

Gets a FunctionEnv by id.

source

pub fn into_function(self, id: FunId) -> FunctionEnv<'env>

Gets a FunctionEnv by id.

source

pub fn get_function_count(&self) -> usize

Gets the number of functions in this module.

source

pub fn get_functions(&'env self) -> impl Iterator<Item = FunctionEnv<'env>>

Returns iterator over FunctionEnvs in this module.

source

pub fn into_functions(self) -> impl Iterator<Item = FunctionEnv<'env>>

Returns iterator over FunctionEnvs in this module.

source

pub fn get_used_function(&self, idx: FunctionHandleIndex) -> FunctionEnv<'_>

Gets FunctionEnv for a function used in this module, via the FunctionHandleIndex. The returned function might be from this or another module.

source

pub fn try_get_function_id(&self, idx: FunctionDefinitionIndex) -> Option<FunId>

Gets the function id from a definition index.

source

pub fn get_function_def_idx(&self, fun_id: FunId) -> FunctionDefinitionIndex

Gets the function definition index for the given function id. This is always defined.

source

pub fn find_struct(&self, name: Symbol) -> Option<StructEnv<'_>>

Gets a StructEnv in this module by name.

source

pub fn find_struct_by_identifier( &self, identifier: Identifier ) -> Option<StructId>

Gets a StructEnv in this module by identifier

source

pub fn get_struct_id(&self, idx: StructDefinitionIndex) -> StructId

Gets the struct id from a definition index which must be valid for this environment.

source

pub fn get_struct(&self, id: StructId) -> StructEnv<'_>

Gets a StructEnv by id.

source

pub fn get_struct_by_def_idx(&self, idx: StructDefinitionIndex) -> StructEnv<'_>

source

pub fn into_struct(self, id: StructId) -> StructEnv<'env>

Gets a StructEnv by id, consuming this module env.

source

pub fn get_struct_count(&self) -> usize

Gets the number of structs in this module.

source

pub fn get_structs(&'env self) -> impl Iterator<Item = StructEnv<'env>>

Returns iterator over structs in this module.

source

pub fn into_structs(self) -> impl Iterator<Item = StructEnv<'env>>

Returns iterator over structs in this module.

source

pub fn globalize_signature(&self, sig: &SignatureToken) -> Type

Globalizes a signature local to this module.

source

pub fn globalize_signatures(&self, sigs: &[SignatureToken]) -> Vec<Type>

Globalizes a list of signatures.

source

pub fn get_type_actuals(&self, idx: Option<SignatureIndex>) -> Vec<Type>

Gets a list of type actuals associated with the index in the bytecode.

source

pub fn get_constant(&self, idx: ConstantPoolIndex) -> &VMConstant

Retrieve a constant from the pool

source

pub fn get_constant_value(&self, constant: &VMConstant) -> MoveValue

Converts a constant to the specified type. The type must correspond to the expected cannonical representation as defined in move_core_types::values

source

pub fn self_address(&self) -> &AccountAddress

Return the AccountAdress of this module

source

pub fn get_address_identifier(&self, idx: AddressIdentifierIndex) -> BigUint

Retrieve an address identifier from the pool

source

pub fn get_spec_vars( &'env self ) -> impl Iterator<Item = (&'env SpecVarId, &'env SpecVarDecl)>

Returns specification variables of this module.

source

pub fn get_spec_var(&self, id: SpecVarId) -> &SpecVarDecl

Gets spec var by id.

source

pub fn find_spec_var(&self, name: Symbol) -> Option<&SpecVarDecl>

Find spec var by name.

source

pub fn get_spec_funs( &'env self ) -> impl Iterator<Item = (&'env SpecFunId, &'env SpecFunDecl)>

Returns specification functions of this module.

source

pub fn get_spec_fun(&self, id: SpecFunId) -> &SpecFunDecl

Gets spec fun by id.

source

pub fn get_spec(&self) -> &Spec

Gets module specification.

source

pub fn spec_fun_is_used(&self, spec_fun_id: SpecFunId) -> bool

Returns whether a spec fun is ever called or not.

source

pub fn get_spec_funs_of_name( &self, name: Symbol ) -> impl Iterator<Item = (&'env SpecFunId, &'env SpecFunDecl)>

Get all spec fun overloads with the given name.

source

pub fn disassemble(&self) -> String

Disassemble the module bytecode

Trait Implementations§

source§

impl<'env> Clone for ModuleEnv<'env>

source§

fn clone(&self) -> ModuleEnv<'env>

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<'env> Debug for ModuleEnv<'env>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'env> !RefUnwindSafe for ModuleEnv<'env>

§

impl<'env> !Send for ModuleEnv<'env>

§

impl<'env> !Sync for ModuleEnv<'env>

§

impl<'env> Unpin for ModuleEnv<'env>

§

impl<'env> !UnwindSafe for ModuleEnv<'env>

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