pub trait MoveStructExt: Sized + Sealed {
Show 17 methods
// Required methods
fn new_from_execution(
tag: StructTag,
version: Version,
contents: Vec<u8>,
protocol_config: &ProtocolConfig,
) -> Result<Self, ExecutionError>;
fn new_from_execution_with_limit(
tag: StructTag,
version: Version,
contents: Vec<u8>,
max_move_object_size: u64,
) -> Result<Self, ExecutionError>;
fn new_gas_coin(version: Version, id: ObjectId, value: u64) -> Self;
fn new_coin(
coin_type: TypeTag,
version: Version,
id: ObjectId,
value: u64,
) -> Self;
fn get_coin_value_unchecked(&self) -> u64;
fn set_coin_value_unchecked(&mut self, value: u64);
fn set_clock_timestamp_ms_unchecked(&mut self, timestamp_ms: u64);
fn update_contents(
&mut self,
new_contents: Vec<u8>,
protocol_config: &ProtocolConfig,
) -> Result<(), ExecutionError>;
fn update_contents_with_limit(
&mut self,
new_contents: Vec<u8>,
max_move_object_size: u64,
) -> Result<(), ExecutionError>;
fn increment_version_to(&mut self, next: Version);
fn decrement_version_to(&mut self, prev: Version);
fn get_layout(
&self,
resolver: &impl GetModule,
) -> Result<MoveStructLayout, IotaError>;
fn get_struct_layout_from_struct_tag(
struct_tag: StructTag,
resolver: &impl GetModule,
) -> Result<MoveStructLayout, IotaError>;
fn to_move_struct(
&self,
layout: &MoveStructLayout,
) -> Result<MoveStruct, IotaError>;
fn object_size_for_gas_metering(&self) -> usize;
fn get_total_iota(
&self,
layout_resolver: &mut dyn LayoutResolver,
) -> Result<u64, IotaError>;
fn get_coin_balances(
&self,
layout_resolver: &mut dyn LayoutResolver,
) -> Result<BTreeMap<TypeTag, u64>, IotaError>;
}Required Methods§
fn new_from_execution( tag: StructTag, version: Version, contents: Vec<u8>, protocol_config: &ProtocolConfig, ) -> Result<Self, ExecutionError>
fn new_from_execution_with_limit( tag: StructTag, version: Version, contents: Vec<u8>, max_move_object_size: u64, ) -> Result<Self, ExecutionError>
fn new_gas_coin(version: Version, id: ObjectId, value: u64) -> Self
fn new_coin( coin_type: TypeTag, version: Version, id: ObjectId, value: u64, ) -> Self
fn get_coin_value_unchecked(&self) -> u64
fn set_coin_value_unchecked(&mut self, value: u64)
fn set_clock_timestamp_ms_unchecked(&mut self, timestamp_ms: u64)
fn update_contents( &mut self, new_contents: Vec<u8>, protocol_config: &ProtocolConfig, ) -> Result<(), ExecutionError>
fn update_contents_with_limit( &mut self, new_contents: Vec<u8>, max_move_object_size: u64, ) -> Result<(), ExecutionError>
fn increment_version_to(&mut self, next: Version)
fn decrement_version_to(&mut self, prev: Version)
fn get_layout( &self, resolver: &impl GetModule, ) -> Result<MoveStructLayout, IotaError>
fn get_struct_layout_from_struct_tag( struct_tag: StructTag, resolver: &impl GetModule, ) -> Result<MoveStructLayout, IotaError>
fn to_move_struct( &self, layout: &MoveStructLayout, ) -> Result<MoveStruct, IotaError>
fn object_size_for_gas_metering(&self) -> usize
fn get_total_iota( &self, layout_resolver: &mut dyn LayoutResolver, ) -> Result<u64, IotaError>
fn get_coin_balances( &self, layout_resolver: &mut dyn LayoutResolver, ) -> Result<BTreeMap<TypeTag, u64>, IotaError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl MoveStructExt for MoveStruct
impl MoveStructExt for MoveStruct
Source§fn new_from_execution(
tag: StructTag,
version: Version,
contents: Vec<u8>,
protocol_config: &ProtocolConfig,
) -> Result<Self, ExecutionError>
fn new_from_execution( tag: StructTag, version: Version, contents: Vec<u8>, protocol_config: &ProtocolConfig, ) -> Result<Self, ExecutionError>
Creates a new Move object of type tag with BCS encoded bytes in
contents.
Source§fn new_from_execution_with_limit(
tag: StructTag,
version: Version,
contents: Vec<u8>,
max_move_object_size: u64,
) -> Result<Self, ExecutionError>
fn new_from_execution_with_limit( tag: StructTag, version: Version, contents: Vec<u8>, max_move_object_size: u64, ) -> Result<Self, ExecutionError>
Creates a new Move object of type tag with BCS encoded bytes in
contents. It allows to set a max_move_object_size for that.
Source§fn get_coin_value_unchecked(&self) -> u64
fn get_coin_value_unchecked(&self) -> u64
Return the value: u64 field of a Coin<T> type.
Useful for reading the coin without deserializing the object into a Move
value. It is the caller’s responsibility to check that self is a coin.
This function may panic or do something unexpected otherwise.
Source§fn set_coin_value_unchecked(&mut self, value: u64)
fn set_coin_value_unchecked(&mut self, value: u64)
Update the value: u64 field of a Coin<T> type.
Useful for updating the coin without deserializing the object into a
Move value. It is the caller’s responsibility to check that self is a
coin.
This function may panic or do something unexpected otherwise.
Source§fn set_clock_timestamp_ms_unchecked(&mut self, timestamp_ms: u64)
fn set_clock_timestamp_ms_unchecked(&mut self, timestamp_ms: u64)
Update the timestamp_ms: u64 field of the Clock type.
Useful for updating the clock without deserializing the object into a
Move value. It is the caller’s responsibility to check that self is a
Clock.
This function may panic or do something unexpected otherwise.
Source§fn update_contents(
&mut self,
new_contents: Vec<u8>,
protocol_config: &ProtocolConfig,
) -> Result<(), ExecutionError>
fn update_contents( &mut self, new_contents: Vec<u8>, protocol_config: &ProtocolConfig, ) -> Result<(), ExecutionError>
Update the contents of this object but does not increment its version
Source§fn increment_version_to(&mut self, next: Version)
fn increment_version_to(&mut self, next: Version)
Sets the version of this object to a new value which is assumed to be higher (and checked to be higher in debug).
Source§fn decrement_version_to(&mut self, prev: Version)
fn decrement_version_to(&mut self, prev: Version)
Sets the version to a lower value (checked in debug).
Source§fn get_layout(
&self,
resolver: &impl GetModule,
) -> Result<MoveStructLayout, IotaError>
fn get_layout( &self, resolver: &impl GetModule, ) -> Result<MoveStructLayout, IotaError>
Get a MoveStructLayout for self.
The resolver value must contain the module that declares
self.object_type and the (transitive) dependencies of
self.object_type in order for this to succeed. Failure will result
in an ObjectSerializationError
Source§fn to_move_struct(
&self,
layout: &MoveStructLayout,
) -> Result<MoveStruct, IotaError>
fn to_move_struct( &self, layout: &MoveStructLayout, ) -> Result<MoveStruct, IotaError>
Convert self to the JSON representation dictated by layout.
Source§fn object_size_for_gas_metering(&self) -> usize
fn object_size_for_gas_metering(&self) -> usize
Approximate size of the object in bytes. This is used for gas metering. For the type tag field, we serialize it on the spot to get the accurate size. This should not be very expensive since the type tag is usually simple, and we only do this once per object being mutated.
Source§fn get_total_iota(
&self,
layout_resolver: &mut dyn LayoutResolver,
) -> Result<u64, IotaError>
fn get_total_iota( &self, layout_resolver: &mut dyn LayoutResolver, ) -> Result<u64, IotaError>
Get the total amount of IOTA embedded in self. Intended for testing
purposes
Source§fn get_coin_balances(
&self,
layout_resolver: &mut dyn LayoutResolver,
) -> Result<BTreeMap<TypeTag, u64>, IotaError>
fn get_coin_balances( &self, layout_resolver: &mut dyn LayoutResolver, ) -> Result<BTreeMap<TypeTag, u64>, IotaError>
Get the total balances for all Coin<T> embedded in self.