Struct fuel_vm::transactor::Transactor
source · [−]pub struct Transactor<'a, S> { /* 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
sourceimpl<'a, S> Transactor<'a, S>
impl<'a, S> Transactor<'a, S>
sourcepub fn new(storage: S, params: ConsensusParameters) -> Self
pub fn new(storage: S, params: ConsensusParameters) -> Self
Transactor constructor
sourcepub const fn state_transition(&self) -> Option<&StateTransitionRef<'a>>
pub const fn state_transition(&self) -> Option<&StateTransitionRef<'a>>
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 receipts(&self) -> Option<&[Receipt]>
pub fn receipts(&self) -> Option<&[Receipt]>
Receipts after the execution of a transaction.
Follows the same criteria as Self::state_transition
to return
None
.
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 fn backtrace(&self) -> Option<Backtrace>
pub fn backtrace(&self) -> Option<Backtrace>
Generate a backtrace when at least one receipt of ScriptResult
was
found.
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(&self) -> Result<&StateTransitionRef<'a>, &InterpreterError>
pub fn result(&self) -> Result<&StateTransitionRef<'a>, &InterpreterError>
Result representation of the last executed transaction.
Will return None
if no transaction was executed.
sourcepub fn interpreter(self) -> Interpreter<S>
pub fn interpreter(self) -> Interpreter<S>
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
sourceimpl<S> Transactor<'_, S> where
S: InterpreterStorage,
impl<S> Transactor<'_, S> where
S: InterpreterStorage,
sourcepub fn transact(&mut self, tx: CheckedTransaction) -> &mut Self
pub fn transact(&mut self, tx: CheckedTransaction) -> &mut Self
Execute a transaction, and return the new state of the transactor
Trait Implementations
sourceimpl<S> AsMut<S> for Transactor<'_, S>
impl<S> AsMut<S> for Transactor<'_, S>
sourceimpl<S> AsRef<Interpreter<S>> for Transactor<'_, S>
impl<S> AsRef<Interpreter<S>> for Transactor<'_, S>
sourcefn as_ref(&self) -> &Interpreter<S>
fn as_ref(&self) -> &Interpreter<S>
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl<S> AsRef<S> for Transactor<'_, S>
impl<S> AsRef<S> for Transactor<'_, S>
sourceimpl<'a, S: Debug> Debug for Transactor<'a, S>
impl<'a, S: Debug> Debug for Transactor<'a, S>
sourceimpl<S> Default for Transactor<'_, S> where
S: Default,
impl<S> Default for Transactor<'_, S> where
S: Default,
sourceimpl<S> From<Interpreter<S>> for Transactor<'_, S>
impl<S> From<Interpreter<S>> for Transactor<'_, S>
sourcefn from(interpreter: Interpreter<S>) -> Self
fn from(interpreter: Interpreter<S>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<MemoryClient<'a>> for Transactor<'a, MemoryStorage>
impl<'a> From<MemoryClient<'a>> for Transactor<'a, MemoryStorage>
sourcefn from(client: MemoryClient<'a>) -> Self
fn from(client: MemoryClient<'a>) -> Self
Converts to this type from the input type.
sourceimpl<S> From<Transactor<'_, S>> for Interpreter<S>
impl<S> From<Transactor<'_, S>> for Interpreter<S>
sourcefn from(transactor: Transactor<'_, S>) -> Self
fn from(transactor: Transactor<'_, S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<'a, S> !RefUnwindSafe for Transactor<'a, S>
impl<'a, S> Send for Transactor<'a, S> where
S: Send,
impl<'a, S> Sync for Transactor<'a, S> where
S: Sync,
impl<'a, S> Unpin for Transactor<'a, S> where
S: Unpin,
impl<'a, S> !UnwindSafe for Transactor<'a, S>
Blanket Implementations
impl<T> Base32Len for T where
T: AsRef<[u8]>,
impl<T> Base32Len for T where
T: AsRef<[u8]>,
fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToHex for T where
T: AsRef<[u8]>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Lower case
letters are used (e.g. f9b4ca
) Read more
sourcefn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Upper case
letters are used (e.g. F9B4CA
) Read more