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

source

pub fn deserialize(binary: &[u8]) -> BinaryLoaderResult<Self>

Deserialize a &u8 slice into a CompiledModule instance.

source

pub fn deserialize_no_check_bounds(binary: &[u8]) -> BinaryLoaderResult<Self>

source§

impl CompiledModule

source

pub fn kind_count(&self, kind: IndexKind) -> usize

Returns the count of a specific IndexKind

source

pub fn module_id_for_handle(&self, module_handle: &ModuleHandle) -> ModuleId

Returns the code key of module_handle

source

pub fn self_id(&self) -> ModuleId

Returns the code key of self

source§

impl CompiledModule

source

pub fn valid_strategy(size: usize) -> impl Strategy<Value = Self>

Convenience wrapper around CompiledModuleStrategyGen that generates valid modules with the given size.

source§

impl CompiledModule

source

pub fn serialize(&self, binary: &mut Vec<u8>) -> Result<()>

Serializes a CompiledModule into a binary. The mutable Vec<u8> will contain the binary blob on return.

Trait Implementations§

source§

impl Arbitrary for CompiledModule

§

type Parameters = usize

The size of the compiled module.

§

type Strategy = BoxedStrategy<CompiledModule>

The type of Strategy used to generate values of type Self.
source§

fn arbitrary_with(size: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
source§

impl Clone for CompiledModule

source§

fn clone(&self) -> CompiledModule

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 CompiledModule

source§

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

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

impl Default for CompiledModule

source§

fn default() -> CompiledModule

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

impl ModuleAccess for CompiledModule

source§

fn as_module(&self) -> &CompiledModule

Returns the CompiledModule that will be used for accesses.
source§

fn self_handle_idx(&self) -> ModuleHandleIndex

source§

fn self_handle(&self) -> &ModuleHandle

Returns the ModuleHandle for self.
source§

fn name(&self) -> &IdentStr

Returns the name of the module.
source§

fn address(&self) -> &AccountAddress

Returns the address of the module.
source§

fn module_handle_at(&self, idx: ModuleHandleIndex) -> &ModuleHandle

source§

fn struct_handle_at(&self, idx: StructHandleIndex) -> &StructHandle

source§

fn function_handle_at(&self, idx: FunctionHandleIndex) -> &FunctionHandle

source§

fn field_handle_at(&self, idx: FieldHandleIndex) -> &FieldHandle

source§

fn struct_instantiation_at( &self, idx: StructDefInstantiationIndex ) -> &StructDefInstantiation

source§

fn function_instantiation_at( &self, idx: FunctionInstantiationIndex ) -> &FunctionInstantiation

source§

fn field_instantiation_at( &self, idx: FieldInstantiationIndex ) -> &FieldInstantiation

source§

fn signature_at(&self, idx: SignatureIndex) -> &Signature

source§

fn identifier_at(&self, idx: IdentifierIndex) -> &IdentStr

source§

fn address_identifier_at(&self, idx: AddressIdentifierIndex) -> &AccountAddress

source§

fn constant_at(&self, idx: ConstantPoolIndex) -> &Constant

source§

fn struct_def_at(&self, idx: StructDefinitionIndex) -> &StructDefinition

source§

fn function_def_at(&self, idx: FunctionDefinitionIndex) -> &FunctionDefinition

source§

fn module_handles(&self) -> &[ModuleHandle]

source§

fn struct_handles(&self) -> &[StructHandle]

source§

fn function_handles(&self) -> &[FunctionHandle]

source§

fn field_handles(&self) -> &[FieldHandle]

source§

fn struct_instantiations(&self) -> &[StructDefInstantiation]

source§

fn function_instantiations(&self) -> &[FunctionInstantiation]

source§

fn field_instantiations(&self) -> &[FieldInstantiation]

source§

fn signatures(&self) -> &[Signature]

source§

fn constant_pool(&self) -> &[Constant]

source§

fn identifiers(&self) -> &[Identifier]

source§

fn address_identifiers(&self) -> &[AccountAddress]

source§

fn struct_defs(&self) -> &[StructDefinition]

source§

fn function_defs(&self) -> &[FunctionDefinition]

source§

fn friend_decls(&self) -> &[ModuleHandle]

source§

fn module_id_for_handle(&self, module_handle_idx: &ModuleHandle) -> ModuleId

source§

fn self_id(&self) -> ModuleId

source§

fn version(&self) -> u32

source§

fn immediate_dependencies(&self) -> Vec<ModuleId>

source§

fn immediate_friends(&self) -> Vec<ModuleId>

source§

fn find_struct_def(&self, idx: StructHandleIndex) -> Option<&StructDefinition>

source§

impl PartialEq<CompiledModule> for CompiledModule

source§

fn eq(&self, other: &CompiledModule) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for CompiledModule

source§

impl StructuralEq for CompiledModule

source§

impl StructuralPartialEq for CompiledModule

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