Struct move_binary_format::file_format::CompiledModule
source · pub struct CompiledModule {Show 16 fields
pub version: u32,
pub self_module_handle_idx: ModuleHandleIndex,
pub module_handles: Vec<ModuleHandle>,
pub struct_handles: Vec<StructHandle>,
pub function_handles: Vec<FunctionHandle>,
pub field_handles: Vec<FieldHandle>,
pub friend_decls: Vec<ModuleHandle>,
pub struct_def_instantiations: Vec<StructDefInstantiation>,
pub function_instantiations: Vec<FunctionInstantiation>,
pub field_instantiations: Vec<FieldInstantiation>,
pub signatures: SignaturePool,
pub identifiers: IdentifierPool,
pub address_identifiers: AddressIdentifierPool,
pub constant_pool: ConstantPool,
pub struct_defs: Vec<StructDefinition>,
pub function_defs: Vec<FunctionDefinition>,
}
Expand description
A CompiledModule
defines the structure of a module which is the unit of published code.
A CompiledModule
contains a definition of types (with their fields) and functions.
It is a unit of code that can be used by transactions or other modules.
A module is published as a single entry and it is retrieved as a single blob.
Fields§
§version: u32
Version number found during deserialization
self_module_handle_idx: ModuleHandleIndex
Handle to self.
module_handles: Vec<ModuleHandle>
Handles to external dependency modules and self.
struct_handles: Vec<StructHandle>
Handles to external and internal types.
function_handles: Vec<FunctionHandle>
Handles to external and internal functions.
field_handles: Vec<FieldHandle>
Handles to fields.
friend_decls: Vec<ModuleHandle>
Friend declarations, represented as a collection of handles to external friend modules.
struct_def_instantiations: Vec<StructDefInstantiation>
Struct instantiations.
function_instantiations: Vec<FunctionInstantiation>
Function instantiations.
field_instantiations: Vec<FieldInstantiation>
Field instantiations.
signatures: SignaturePool
Locals signature pool. The signature for all locals of the functions defined in the module.
identifiers: IdentifierPool
All identifiers used in this module.
address_identifiers: AddressIdentifierPool
All address identifiers used in this module.
constant_pool: ConstantPool
Constant pool. The constant values used in the module.
struct_defs: Vec<StructDefinition>
Types defined in this module.
function_defs: Vec<FunctionDefinition>
Function defined in this module.
Implementations§
source§impl CompiledModule
impl CompiledModule
sourcepub fn deserialize(binary: &[u8]) -> BinaryLoaderResult<Self>
pub fn deserialize(binary: &[u8]) -> BinaryLoaderResult<Self>
Deserialize a &u8 slice into a CompiledModule
instance.
pub fn deserialize_no_check_bounds(binary: &[u8]) -> BinaryLoaderResult<Self>
source§impl CompiledModule
impl CompiledModule
sourcepub fn kind_count(&self, kind: IndexKind) -> usize
pub fn kind_count(&self, kind: IndexKind) -> usize
Returns the count of a specific IndexKind
sourcepub fn module_id_for_handle(&self, module_handle: &ModuleHandle) -> ModuleId
pub fn module_id_for_handle(&self, module_handle: &ModuleHandle) -> ModuleId
Returns the code key of module_handle
source§impl CompiledModule
impl CompiledModule
sourcepub fn valid_strategy(size: usize) -> impl Strategy<Value = Self>
pub fn valid_strategy(size: usize) -> impl Strategy<Value = Self>
Convenience wrapper around CompiledModuleStrategyGen
that
generates valid modules with the given size.
Trait Implementations§
source§impl Arbitrary for CompiledModule
impl Arbitrary for CompiledModule
§type Parameters = usize
type Parameters = usize
The size of the compiled module.
§type Strategy = BoxedStrategy<CompiledModule>
type Strategy = BoxedStrategy<CompiledModule>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(size: Self::Parameters) -> Self::Strategy
fn arbitrary_with(size: Self::Parameters) -> Self::Strategy
source§impl Clone for CompiledModule
impl Clone for CompiledModule
source§fn clone(&self) -> CompiledModule
fn clone(&self) -> CompiledModule
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CompiledModule
impl Debug for CompiledModule
source§impl Default for CompiledModule
impl Default for CompiledModule
source§fn default() -> CompiledModule
fn default() -> CompiledModule
source§impl ModuleAccess for CompiledModule
impl ModuleAccess for CompiledModule
source§fn as_module(&self) -> &CompiledModule
fn as_module(&self) -> &CompiledModule
CompiledModule
that will be used for accesses.fn self_handle_idx(&self) -> ModuleHandleIndex
source§fn self_handle(&self) -> &ModuleHandle
fn self_handle(&self) -> &ModuleHandle
ModuleHandle
for self
.fn module_handle_at(&self, idx: ModuleHandleIndex) -> &ModuleHandle
fn struct_handle_at(&self, idx: StructHandleIndex) -> &StructHandle
fn function_handle_at(&self, idx: FunctionHandleIndex) -> &FunctionHandle
fn field_handle_at(&self, idx: FieldHandleIndex) -> &FieldHandle
fn struct_instantiation_at( &self, idx: StructDefInstantiationIndex ) -> &StructDefInstantiation
fn function_instantiation_at( &self, idx: FunctionInstantiationIndex ) -> &FunctionInstantiation
fn field_instantiation_at( &self, idx: FieldInstantiationIndex ) -> &FieldInstantiation
fn signature_at(&self, idx: SignatureIndex) -> &Signature
fn identifier_at(&self, idx: IdentifierIndex) -> &IdentStr
fn address_identifier_at(&self, idx: AddressIdentifierIndex) -> &AccountAddress
fn constant_at(&self, idx: ConstantPoolIndex) -> &Constant
fn struct_def_at(&self, idx: StructDefinitionIndex) -> &StructDefinition
fn function_def_at(&self, idx: FunctionDefinitionIndex) -> &FunctionDefinition
fn module_handles(&self) -> &[ModuleHandle]
fn struct_handles(&self) -> &[StructHandle]
fn function_handles(&self) -> &[FunctionHandle]
fn field_handles(&self) -> &[FieldHandle]
fn struct_instantiations(&self) -> &[StructDefInstantiation]
fn function_instantiations(&self) -> &[FunctionInstantiation]
fn field_instantiations(&self) -> &[FieldInstantiation]
fn signatures(&self) -> &[Signature]
fn constant_pool(&self) -> &[Constant]
fn identifiers(&self) -> &[Identifier]
fn address_identifiers(&self) -> &[AccountAddress]
fn struct_defs(&self) -> &[StructDefinition]
fn function_defs(&self) -> &[FunctionDefinition]
fn friend_decls(&self) -> &[ModuleHandle]
fn module_id_for_handle(&self, module_handle_idx: &ModuleHandle) -> ModuleId
fn self_id(&self) -> ModuleId
fn version(&self) -> u32
fn immediate_dependencies(&self) -> Vec<ModuleId> ⓘ
fn immediate_friends(&self) -> Vec<ModuleId> ⓘ
fn find_struct_def(&self, idx: StructHandleIndex) -> Option<&StructDefinition>
source§impl PartialEq<CompiledModule> for CompiledModule
impl PartialEq<CompiledModule> for CompiledModule
source§fn eq(&self, other: &CompiledModule) -> bool
fn eq(&self, other: &CompiledModule) -> bool
self
and other
values to be equal, and is used
by ==
.