Struct fuel_vm::transactor::Transactor
source · pub struct Transactor<S, Tx> { /* private fields */ }
Expand description
State machine to execute transactions and provide runtime entities on demand.
Builder pattern for Interpreter
. Follows the recommended Non-consuming builder
.
Based on https://doc.rust-lang.org/1.5.0/style/ownership/builders.html#non-consuming-builders-preferred
Implementations§
source§impl<'a, S, Tx> Transactor<S, Tx>where
Tx: ExecutableTransaction,
impl<'a, S, Tx> Transactor<S, Tx>where Tx: ExecutableTransaction,
sourcepub fn new(storage: S, params: ConsensusParameters, gas_costs: GasCosts) -> Self
pub fn new(storage: S, params: ConsensusParameters, gas_costs: GasCosts) -> Self
Transactor constructor
sourcepub fn state_transition(&'a self) -> Option<StateTransitionRef<'a, Tx>>
pub fn state_transition(&'a self) -> Option<StateTransitionRef<'a, Tx>>
State transition representation after the execution of a transaction.
Will be None
if the last transaction resulted in a VM panic, or if no
transaction was executed.
sourcepub fn to_owned_state_transition(&self) -> Option<StateTransition<Tx>>
pub fn to_owned_state_transition(&self) -> Option<StateTransition<Tx>>
State transition representation after the execution of a transaction.
Will be None
if the last transaction resulted in a VM panic, or if no
transaction was executed.
sourcepub const fn error(&self) -> Option<&InterpreterError>
pub const fn error(&self) -> Option<&InterpreterError>
Interpreter error representation after the execution of a transaction.
Follows the same criteria as Self::state_transition
to return
None
.
Will be None
if the last transaction resulted successful, or if no
transaction was executed.
sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Returns true if last transaction execution was successful
sourcepub fn result(&'a self) -> Result<StateTransitionRef<'a, Tx>, &InterpreterError>
pub fn result(&'a self) -> Result<StateTransitionRef<'a, Tx>, &InterpreterError>
Result representation of the last executed transaction.
Will return None
if no transaction was executed.
sourcepub fn interpreter(self) -> Interpreter<S, Tx>
pub fn interpreter(self) -> Interpreter<S, Tx>
Convert this transaction into the underlying VM instance.
This isn’t a two-way operation since if you convert this instance into the raw VM, then you lose the transactor state.
sourcepub const fn params(&self) -> &ConsensusParameters
pub const fn params(&self) -> &ConsensusParameters
Consensus parameters
source§impl<S> Transactor<S, Script>
impl<S> Transactor<S, Script>
source§impl<S, Tx> Transactor<S, Tx>where
S: InterpreterStorage,
impl<S, Tx> Transactor<S, Tx>where S: InterpreterStorage,
source§impl<S, Tx> Transactor<S, Tx>where
S: InterpreterStorage,
Tx: ExecutableTransaction,
<Tx as IntoChecked>::Metadata: CheckedMetadata,
impl<S, Tx> Transactor<S, Tx>where S: InterpreterStorage, Tx: ExecutableTransaction, <Tx as IntoChecked>::Metadata: CheckedMetadata,
Trait Implementations§
source§impl<S, Tx> AsMut<S> for Transactor<S, Tx>where
Tx: ExecutableTransaction,
impl<S, Tx> AsMut<S> for Transactor<S, Tx>where Tx: ExecutableTransaction,
source§impl<S, Tx> AsRef<Interpreter<S, Tx>> for Transactor<S, Tx>where
Tx: ExecutableTransaction,
impl<S, Tx> AsRef<Interpreter<S, Tx>> for Transactor<S, Tx>where Tx: ExecutableTransaction,
source§fn as_ref(&self) -> &Interpreter<S, Tx>
fn as_ref(&self) -> &Interpreter<S, Tx>
source§impl<S, Tx> AsRef<S> for Transactor<S, Tx>where
Tx: ExecutableTransaction,
impl<S, Tx> AsRef<S> for Transactor<S, Tx>where Tx: ExecutableTransaction,
source§impl<S, Tx> Default for Transactor<S, Tx>where
S: Default,
Tx: ExecutableTransaction,
impl<S, Tx> Default for Transactor<S, Tx>where S: Default, Tx: ExecutableTransaction,
source§impl<S, Tx> From<Interpreter<S, Tx>> for Transactor<S, Tx>where
Tx: ExecutableTransaction,
impl<S, Tx> From<Interpreter<S, Tx>> for Transactor<S, Tx>where Tx: ExecutableTransaction,
source§fn from(interpreter: Interpreter<S, Tx>) -> Self
fn from(interpreter: Interpreter<S, Tx>) -> Self
source§impl From<MemoryClient> for Transactor<MemoryStorage, Script>
impl From<MemoryClient> for Transactor<MemoryStorage, Script>
source§fn from(client: MemoryClient) -> Self
fn from(client: MemoryClient) -> Self
source§impl<S, Tx> From<Transactor<S, Tx>> for Interpreter<S, Tx>where
Tx: ExecutableTransaction,
impl<S, Tx> From<Transactor<S, Tx>> for Interpreter<S, Tx>where Tx: ExecutableTransaction,
source§fn from(transactor: Transactor<S, Tx>) -> Self
fn from(transactor: Transactor<S, Tx>) -> Self
Auto Trait Implementations§
impl<S, Tx> !RefUnwindSafe for Transactor<S, Tx>
impl<S, Tx> Send for Transactor<S, Tx>where S: Send, Tx: Send,
impl<S, Tx> Sync for Transactor<S, Tx>where S: Sync, Tx: Sync,
impl<S, Tx> Unpin for Transactor<S, Tx>where S: Unpin, Tx: Unpin,
impl<S, Tx> !UnwindSafe for Transactor<S, Tx>
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Any
.§impl<T> Base32Len for Twhere
T: AsRef<[u8]>,
impl<T> Base32Len for Twhere T: AsRef<[u8]>,
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> StorageAsMut for T
impl<T> StorageAsMut for T
fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,
fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,
source§impl<T> StorageAsRef for T
impl<T> StorageAsRef for T
fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,
fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,
source§impl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere T: AsRef<[u8]>,
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)