Struct fuel_vm::transactor::Transactor
source · pub struct Transactor<M, S, Tx, Ecal = NotSupportedEcal>where
S: InterpreterStorage,{ /* 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<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>
sourcepub fn new(memory: M, storage: S, interpreter_params: InterpreterParams) -> Self
pub fn new(memory: M, storage: S, interpreter_params: InterpreterParams) -> Self
Transactor constructor
source§impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>
sourcepub fn state_transition(&self) -> Option<StateTransitionRef<'_, Tx>>
pub fn state_transition(&self) -> Option<StateTransitionRef<'_, 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<S::DataError>>
pub const fn error(&self) -> Option<&InterpreterError<S::DataError>>
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 const fn is_reverted(&self) -> bool
pub const fn is_reverted(&self) -> bool
Returns true if last transaction execution was erroneous
sourcepub fn result(
&self,
) -> Result<StateTransitionRef<'_, Tx>, &InterpreterError<S::DataError>>
pub fn result( &self, ) -> Result<StateTransitionRef<'_, Tx>, &InterpreterError<S::DataError>>
Result representation of the last executed transaction.
Will return None
if no transaction was executed.
sourcepub fn interpreter(&self) -> &Interpreter<M, S, Tx, Ecal>
pub fn interpreter(&self) -> &Interpreter<M, S, Tx, Ecal>
Gets the interpreter.
sourcepub fn fee_params(&self) -> &FeeParameters
pub fn fee_params(&self) -> &FeeParameters
Fee parameters
source§impl<M, S, Ecal> Transactor<M, S, Script, Ecal>where
M: Memory,
S: InterpreterStorage,
impl<M, S, Ecal> Transactor<M, S, Script, Ecal>where
M: Memory,
S: InterpreterStorage,
source§impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>where
S: InterpreterStorage,
impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>where
S: InterpreterStorage,
sourcepub fn deploy(
&mut self,
checked: Checked<Create>,
) -> Result<Create, InterpreterError<S::DataError>>
pub fn deploy( &mut self, checked: Checked<Create>, ) -> Result<Create, InterpreterError<S::DataError>>
Deploys Create
checked transactions.
sourcepub fn deploy_ready_tx(
&mut self,
ready_tx: Ready<Create>,
) -> Result<Create, InterpreterError<S::DataError>>
pub fn deploy_ready_tx( &mut self, ready_tx: Ready<Create>, ) -> Result<Create, InterpreterError<S::DataError>>
Deployt a Ready
transaction directly instead of letting Transactor
construct
sourcepub fn upgrade(
&mut self,
checked: Checked<Upgrade>,
) -> Result<Upgrade, InterpreterError<S::DataError>>
pub fn upgrade( &mut self, checked: Checked<Upgrade>, ) -> Result<Upgrade, InterpreterError<S::DataError>>
Executes Upgrade
checked transactions.
sourcepub fn execute_ready_upgrade_tx(
&mut self,
ready_tx: Ready<Upgrade>,
) -> Result<Upgrade, InterpreterError<S::DataError>>
pub fn execute_ready_upgrade_tx( &mut self, ready_tx: Ready<Upgrade>, ) -> Result<Upgrade, InterpreterError<S::DataError>>
Executes a Ready
transaction directly instead of letting Transactor
construct
sourcepub fn upload(
&mut self,
checked: Checked<Upload>,
) -> Result<Upload, InterpreterError<S::DataError>>
pub fn upload( &mut self, checked: Checked<Upload>, ) -> Result<Upload, InterpreterError<S::DataError>>
Executes Upload
checked transactions.
sourcepub fn execute_ready_upload_tx(
&mut self,
ready_tx: Ready<Upload>,
) -> Result<Upload, InterpreterError<S::DataError>>
pub fn execute_ready_upload_tx( &mut self, ready_tx: Ready<Upload>, ) -> Result<Upload, InterpreterError<S::DataError>>
Executes a Ready
transaction directly instead of letting Transactor
construct
source§impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>where
M: Memory,
S: InterpreterStorage,
Tx: ExecutableTransaction,
<Tx as IntoChecked>::Metadata: CheckedMetadata,
Ecal: EcalHandler,
impl<M, S, Tx, Ecal> Transactor<M, S, Tx, Ecal>where
M: Memory,
S: InterpreterStorage,
Tx: ExecutableTransaction,
<Tx as IntoChecked>::Metadata: CheckedMetadata,
Ecal: EcalHandler,
Trait Implementations§
source§impl<M, S, Tx, Ecal> AsMut<S> for Transactor<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
impl<M, S, Tx, Ecal> AsMut<S> for Transactor<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
source§impl<M, S, Tx, Ecal> AsRef<Interpreter<M, S, Tx, Ecal>> for Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> AsRef<Interpreter<M, S, Tx, Ecal>> for Transactor<M, S, Tx, Ecal>
source§fn as_ref(&self) -> &Interpreter<M, S, Tx, Ecal>
fn as_ref(&self) -> &Interpreter<M, S, Tx, Ecal>
source§impl<M, S, Tx, Ecal> AsRef<S> for Transactor<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
impl<M, S, Tx, Ecal> AsRef<S> for Transactor<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
source§impl<M, S, Tx, Ecal> From<Interpreter<M, S, Tx, Ecal>> for Transactor<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
impl<M, S, Tx, Ecal> From<Interpreter<M, S, Tx, Ecal>> for Transactor<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
source§fn from(interpreter: Interpreter<M, S, Tx, Ecal>) -> Self
fn from(interpreter: Interpreter<M, S, Tx, Ecal>) -> Self
source§impl<M, Ecal: EcalHandler> From<MemoryClient<M, Ecal>> for Transactor<M, MemoryStorage, Script, Ecal>
impl<M, Ecal: EcalHandler> From<MemoryClient<M, Ecal>> for Transactor<M, MemoryStorage, Script, Ecal>
source§fn from(client: MemoryClient<M, Ecal>) -> Self
fn from(client: MemoryClient<M, Ecal>) -> Self
source§impl<M, S, Tx, Ecal> From<Transactor<M, S, Tx, Ecal>> for Interpreter<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
impl<M, S, Tx, Ecal> From<Transactor<M, S, Tx, Ecal>> for Interpreter<M, S, Tx, Ecal>where
Tx: ExecutableTransaction,
S: InterpreterStorage,
source§fn from(transactor: Transactor<M, S, Tx, Ecal>) -> Self
fn from(transactor: Transactor<M, S, Tx, Ecal>) -> Self
Auto Trait Implementations§
impl<M, S, Tx, Ecal> Freeze for Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> RefUnwindSafe for Transactor<M, S, Tx, Ecal>where
M: RefUnwindSafe,
Tx: RefUnwindSafe,
S: RefUnwindSafe,
Ecal: RefUnwindSafe,
<S as InterpreterStorage>::DataError: RefUnwindSafe,
impl<M, S, Tx, Ecal> Send for Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> Sync for Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> Unpin for Transactor<M, S, Tx, Ecal>
impl<M, S, Tx, Ecal> UnwindSafe for Transactor<M, S, Tx, Ecal>where
M: UnwindSafe,
Tx: UnwindSafe,
S: UnwindSafe,
Ecal: UnwindSafe,
<S as InterpreterStorage>::DataError: UnwindSafe,
Blanket Implementations§
source§impl<T> AnyDebug for T
impl<T> AnyDebug for T
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Any
.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> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.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> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.