pub struct NetworkState { /* private fields */ }Expand description
Implementations§
Source§impl NetworkState
impl NetworkState
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns a new empty NetworkState.
Sourcepub fn with_schedule(schedule: &Schedule) -> Self
pub fn with_schedule(schedule: &Schedule) -> Self
Returns a NetworkState based on a schedule
Sourcepub fn get_contract<'a>(
&'a self,
contract_id: &ContractId,
) -> Result<impl Deref<Target = Contract> + 'a, VMError>
pub fn get_contract<'a>( &'a self, contract_id: &ContractId, ) -> Result<impl Deref<Target = Contract> + 'a, VMError>
Returns a reference to the specified contracts state in the head
state.
Sourcepub fn get_contract_mut<'a>(
&'a mut self,
contract_id: &ContractId,
) -> Result<impl DerefMut<Target = Contract> + 'a, VMError>
pub fn get_contract_mut<'a>( &'a mut self, contract_id: &ContractId, ) -> Result<impl DerefMut<Target = Contract> + 'a, VMError>
Returns a mutable reference to the specified contracts state in the
origin state.
Sourcepub fn deploy(&mut self, contract: Contract) -> Result<ContractId, VMError>
pub fn deploy(&mut self, contract: Contract) -> Result<ContractId, VMError>
Deploys a contract to the head state, returning the address of the
created contract or an error.
Sourcepub fn deploy_with_id(
&mut self,
id: ContractId,
contract: Contract,
) -> Result<ContractId, VMError>
pub fn deploy_with_id( &mut self, id: ContractId, contract: Contract, ) -> Result<ContractId, VMError>
Deploys a contract to the head state with the given id / address.
Sourcepub fn query<A, R>(
&mut self,
target: ContractId,
block_height: u64,
query: A,
gas_meter: &mut GasMeter,
) -> Result<R, VMError>
pub fn query<A, R>( &mut self, target: ContractId, block_height: u64, query: A, gas_meter: &mut GasMeter, ) -> Result<R, VMError>
Query the contract at target address in the head state.
Sourcepub fn transact<A, R>(
&mut self,
target: ContractId,
block_height: u64,
transaction: A,
gas_meter: &mut GasMeter,
) -> Result<R, VMError>
pub fn transact<A, R>( &mut self, target: ContractId, block_height: u64, transaction: A, gas_meter: &mut GasMeter, ) -> Result<R, VMError>
Transact with the contract at target address in the head state,
returning the result of the transaction.
This will advance the head to the resultant state.
Sourcepub fn register_host_module<M>(&mut self, module: M)
pub fn register_host_module<M>(&mut self, module: M)
Register a host function handler.
Sourcepub fn get_contract_cast_state<C>(
&self,
contract_id: &ContractId,
) -> Result<C, VMError>where
C: Canon,
pub fn get_contract_cast_state<C>(
&self,
contract_id: &ContractId,
) -> Result<C, VMError>where
C: Canon,
Gets the state of the given contract in the head state.
Sourcepub fn get_module_config(&self) -> &ModuleConfig
pub fn get_module_config(&self) -> &ModuleConfig
Gets module config
Trait Implementations§
Source§impl Canon for NetworkState
Custom implementation of Canon ensuring only the head state is encoded.
When restored, head is set to be a copy of origin and the modules are to
be set by the caller.
impl Canon for NetworkState
Custom implementation of Canon ensuring only the head state is encoded.
When restored, head is set to be a copy of origin and the modules are to
be set by the caller.
Source§impl Clone for NetworkState
impl Clone for NetworkState
Source§fn clone(&self) -> NetworkState
fn clone(&self) -> NetworkState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for NetworkState
impl Default for NetworkState
Source§fn default() -> NetworkState
fn default() -> NetworkState
Auto Trait Implementations§
impl !Freeze for NetworkState
impl !RefUnwindSafe for NetworkState
impl Send for NetworkState
impl Sync for NetworkState
impl Unpin for NetworkState
impl !UnwindSafe for NetworkState
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> EncodeToVec for Twhere
T: Canon,
impl<T> EncodeToVec for Twhere
T: Canon,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more