pub struct WasmTestBuilder<S> { /* private fields */ }
Expand description
Builder for simple WASM test
Implementations§
source§impl WasmTestBuilder<InMemoryGlobalState>
impl WasmTestBuilder<InMemoryGlobalState>
sourcepub fn new_with_config(engine_config: EngineConfig) -> Self
pub fn new_with_config(engine_config: EngineConfig) -> Self
Returns an InMemoryWasmTestBuilder
initialized with an engine config instance.
sourcepub fn new(
global_state: InMemoryGlobalState,
engine_config: EngineConfig,
maybe_post_state_hash: Option<Digest>
) -> Self
pub fn new( global_state: InMemoryGlobalState, engine_config: EngineConfig, maybe_post_state_hash: Option<Digest> ) -> Self
Returns an InMemoryWasmTestBuilder
.
sourcepub fn new_with_chainspec<P: AsRef<Path>>(
chainspec_path: P,
post_state_hash: Option<Digest>
) -> Self
pub fn new_with_chainspec<P: AsRef<Path>>( chainspec_path: P, post_state_hash: Option<Digest> ) -> Self
Returns an InMemoryWasmTestBuilder
instantiated using values from a given chainspec.
source§impl WasmTestBuilder<LmdbGlobalState>
impl WasmTestBuilder<LmdbGlobalState>
sourcepub fn upgrade_with_upgrade_request_using_scratch(
&mut self,
engine_config: EngineConfig,
upgrade_config: &mut UpgradeConfig
) -> &mut Self
pub fn upgrade_with_upgrade_request_using_scratch( &mut self, engine_config: EngineConfig, upgrade_config: &mut UpgradeConfig ) -> &mut Self
Upgrades the execution engine using the scratch trie.
sourcepub fn new_with_config<T: AsRef<OsStr> + ?Sized>(
data_dir: &T,
engine_config: EngineConfig
) -> Self
pub fn new_with_config<T: AsRef<OsStr> + ?Sized>( data_dir: &T, engine_config: EngineConfig ) -> Self
Returns an LmdbWasmTestBuilder
with configuration.
sourcepub fn new_with_chainspec<T: AsRef<OsStr> + ?Sized, P: AsRef<Path>>(
data_dir: &T,
chainspec_path: P
) -> Self
pub fn new_with_chainspec<T: AsRef<OsStr> + ?Sized, P: AsRef<Path>>( data_dir: &T, chainspec_path: P ) -> Self
Returns an LmdbWasmTestBuilder
with configuration and values from
a given chainspec.
sourcepub fn new_with_production_chainspec<T: AsRef<OsStr> + ?Sized>(
data_dir: &T
) -> Self
pub fn new_with_production_chainspec<T: AsRef<OsStr> + ?Sized>( data_dir: &T ) -> Self
Returns an LmdbWasmTestBuilder
with configuration and values from
the production chainspec.
sourcepub fn flush_environment(&self)
pub fn flush_environment(&self)
Flushes the LMDB environment to disk.
sourcepub fn open<T: AsRef<OsStr> + ?Sized>(
data_dir: &T,
engine_config: EngineConfig,
post_state_hash: Digest
) -> Self
pub fn open<T: AsRef<OsStr> + ?Sized>( data_dir: &T, engine_config: EngineConfig, post_state_hash: Digest ) -> Self
Creates a new instance of builder using the supplied configurations, opening wrapped LMDBs (e.g. in the Trie and Data stores) rather than creating them.
sourcepub fn open_raw<T: AsRef<Path>>(
global_state_dir: T,
engine_config: EngineConfig,
post_state_hash: Digest
) -> Self
pub fn open_raw<T: AsRef<Path>>( global_state_dir: T, engine_config: EngineConfig, post_state_hash: Digest ) -> Self
Creates a new instance of builder using the supplied configurations, opening wrapped LMDBs
(e.g. in the Trie and Data stores) rather than creating them.
Differs from open
in that it doesn’t append GLOBAL_STATE_DIR
to the supplied path.
sourcepub fn lmdb_on_disk_size(&self) -> Option<u64>
pub fn lmdb_on_disk_size(&self) -> Option<u64>
Returns the file size on disk of the backing lmdb file behind LmdbGlobalState.
sourcepub fn scratch_exec_and_commit(
&mut self,
exec_request: ExecuteRequest
) -> &mut Self
pub fn scratch_exec_and_commit( &mut self, exec_request: ExecuteRequest ) -> &mut Self
Execute and commit transforms from an ExecuteRequest into a scratch global state. You MUST call write_scratch_to_lmdb to flush these changes to LmdbGlobalState.
sourcepub fn write_scratch_to_db(&mut self) -> &mut Self
pub fn write_scratch_to_db(&mut self) -> &mut Self
Commit scratch to global state, and reset the scratch cache.
sourcepub fn step_with_scratch(&mut self, step_request: StepRequest) -> &mut Self
pub fn step_with_scratch(&mut self, step_request: StepRequest) -> &mut Self
run step against scratch global state.
source§impl<S> WasmTestBuilder<S>
impl<S> WasmTestBuilder<S>
sourcepub fn run_genesis(
&mut self,
run_genesis_request: &RunGenesisRequest
) -> &mut Self
pub fn run_genesis( &mut self, run_genesis_request: &RunGenesisRequest ) -> &mut Self
Takes a RunGenesisRequest
, executes the request and returns Self.
sourcepub fn query(
&self,
maybe_post_state: Option<Digest>,
base_key: Key,
path: &[String]
) -> Result<StoredValue, String>
pub fn query( &self, maybe_post_state: Option<Digest>, base_key: Key, path: &[String] ) -> Result<StoredValue, String>
Queries state for a StoredValue
.
sourcepub fn query_dictionary_item(
&self,
maybe_post_state: Option<Digest>,
dictionary_seed_uref: URef,
dictionary_item_key: &str
) -> Result<StoredValue, String>
pub fn query_dictionary_item( &self, maybe_post_state: Option<Digest>, dictionary_seed_uref: URef, dictionary_item_key: &str ) -> Result<StoredValue, String>
Queries state for a dictionary item.
sourcepub fn query_with_proof(
&self,
maybe_post_state: Option<Digest>,
base_key: Key,
path: &[String]
) -> Result<(StoredValue, Vec<TrieMerkleProof<Key, StoredValue>>), String>
pub fn query_with_proof( &self, maybe_post_state: Option<Digest>, base_key: Key, path: &[String] ) -> Result<(StoredValue, Vec<TrieMerkleProof<Key, StoredValue>>), String>
Queries for a StoredValue
and returns the StoredValue
and a Merkle proof.
sourcepub fn total_supply(&self, maybe_post_state: Option<Digest>) -> U512
pub fn total_supply(&self, maybe_post_state: Option<Digest>) -> U512
sourcepub fn base_round_reward(&mut self, maybe_post_state: Option<Digest>) -> U512
pub fn base_round_reward(&mut self, maybe_post_state: Option<Digest>) -> U512
Queries for the base round reward.
§Panics
Panics if the total supply or seigniorage rate can’t be found.
sourcepub fn exec(&mut self, exec_request: ExecuteRequest) -> &mut Self
pub fn exec(&mut self, exec_request: ExecuteRequest) -> &mut Self
Runs an ExecuteRequest
.
sourcepub fn try_exec(
&mut self,
exec_request: ExecuteRequest
) -> Result<&mut Self, Error>
pub fn try_exec( &mut self, exec_request: ExecuteRequest ) -> Result<&mut Self, Error>
Tries to run an ExecuteRequest
.
sourcepub fn commit(&mut self) -> &mut Self
pub fn commit(&mut self) -> &mut Self
Commit effects of previous exec call on the latest post-state hash.
sourcepub fn commit_transforms(
&mut self,
pre_state_hash: Digest,
effects: AdditiveMap<Key, Transform>
) -> &mut Self
pub fn commit_transforms( &mut self, pre_state_hash: Digest, effects: AdditiveMap<Key, Transform> ) -> &mut Self
Runs a commit request, expects a successful response, and overwrites existing cached post state hash with a new one.
sourcepub fn upgrade_with_upgrade_request(
&mut self,
engine_config: EngineConfig,
upgrade_config: &mut UpgradeConfig
) -> &mut Self
pub fn upgrade_with_upgrade_request( &mut self, engine_config: EngineConfig, upgrade_config: &mut UpgradeConfig ) -> &mut Self
Upgrades the execution engine. Deprecated - this path does not use the scratch trie and generates many interstitial commits on upgrade.
sourcepub fn upgrade_with_upgrade_request_and_config(
&mut self,
engine_config: Option<EngineConfig>,
upgrade_config: &mut UpgradeConfig
) -> &mut Self
pub fn upgrade_with_upgrade_request_and_config( &mut self, engine_config: Option<EngineConfig>, upgrade_config: &mut UpgradeConfig ) -> &mut Self
Upgrades the execution engine.
If engine_config
is set to None, then it is defaulted to the current one.
sourcepub fn run_auction(
&mut self,
era_end_timestamp_millis: u64,
evicted_validators: Vec<PublicKey>
) -> &mut Self
pub fn run_auction( &mut self, era_end_timestamp_millis: u64, evicted_validators: Vec<PublicKey> ) -> &mut Self
Executes a request to call the system auction contract.
sourcepub fn step(
&mut self,
step_request: StepRequest
) -> Result<StepSuccess, StepError>
pub fn step( &mut self, step_request: StepRequest ) -> Result<StepSuccess, StepError>
Increments engine state.
sourcepub fn expect_success(&mut self) -> &mut Self
pub fn expect_success(&mut self) -> &mut Self
Expects a successful run
sourcepub fn expect_failure(&mut self) -> &mut Self
pub fn expect_failure(&mut self) -> &mut Self
Expects a failed run
sourcepub fn is_error(&self) -> bool
pub fn is_error(&self) -> bool
Returns true
if the las exec had an error, otherwise returns false.
sourcepub fn get_error(&self) -> Option<Error>
pub fn get_error(&self) -> Option<Error>
Returns an Option<engine_state::Error>
if the last exec had an error.
sourcepub fn get_execution_journals(&self) -> Vec<ExecutionJournal>
pub fn get_execution_journals(&self) -> Vec<ExecutionJournal>
Gets ExecutionJournal
s of all passed runs.
sourcepub fn get_genesis_account(&self) -> &Account
pub fn get_genesis_account(&self) -> &Account
Gets genesis account (if present)
sourcepub fn get_mint_contract_hash(&self) -> ContractHash
pub fn get_mint_contract_hash(&self) -> ContractHash
Returns the ContractHash
of the mint, panics if it can’t be found.
sourcepub fn get_handle_payment_contract_hash(&self) -> ContractHash
pub fn get_handle_payment_contract_hash(&self) -> ContractHash
Returns the ContractHash
of the “handle payment” contract, panics if it can’t be found.
sourcepub fn get_standard_payment_contract_hash(&self) -> ContractHash
pub fn get_standard_payment_contract_hash(&self) -> ContractHash
Returns the ContractHash
of the “standard payment” contract, panics if it can’t be
found.
sourcepub fn get_auction_contract_hash(&self) -> ContractHash
pub fn get_auction_contract_hash(&self) -> ContractHash
Returns the ContractHash
of the “auction” contract, panics if it can’t be found.
sourcepub fn get_genesis_transforms(&self) -> &AdditiveMap<Key, Transform>
pub fn get_genesis_transforms(&self) -> &AdditiveMap<Key, Transform>
Returns genesis transforms, panics if there aren’t any.
sourcepub fn get_genesis_hash(&self) -> Digest
pub fn get_genesis_hash(&self) -> Digest
Returns the genesis hash, panics if it can’t be found.
sourcepub fn get_post_state_hash(&self) -> Digest
pub fn get_post_state_hash(&self) -> Digest
Returns the post state hash, panics if it can’t be found.
sourcepub fn get_engine_state(&self) -> &EngineState<S>
pub fn get_engine_state(&self) -> &EngineState<S>
Returns the engine state.
sourcepub fn get_last_exec_results(&self) -> Option<Vec<Rc<ExecutionResult>>>
pub fn get_last_exec_results(&self) -> Option<Vec<Rc<ExecutionResult>>>
Returns the last results execs.
sourcepub fn get_exec_result_owned(
&self,
index: usize
) -> Option<Vec<Rc<ExecutionResult>>>
pub fn get_exec_result_owned( &self, index: usize ) -> Option<Vec<Rc<ExecutionResult>>>
Returns the owned results of a specific exec.
sourcepub fn get_exec_results_count(&self) -> usize
pub fn get_exec_results_count(&self) -> usize
Returns a count of exec results.
sourcepub fn get_upgrade_result(
&self,
index: usize
) -> Option<&Result<UpgradeSuccess, Error>>
pub fn get_upgrade_result( &self, index: usize ) -> Option<&Result<UpgradeSuccess, Error>>
Returns a Result
containing an UpgradeSuccess
.
sourcepub fn expect_upgrade_success(&mut self) -> &mut Self
pub fn expect_upgrade_success(&mut self) -> &mut Self
Expects upgrade success.
sourcepub fn get_handle_payment_contract(&self) -> Contract
pub fn get_handle_payment_contract(&self) -> Contract
Returns the “handle payment” contract, panics if it can’t be found.
sourcepub fn get_purse_balance(&self, purse: URef) -> U512
pub fn get_purse_balance(&self, purse: URef) -> U512
Returns the balance of a purse, panics if the balance can’t be parsed into a U512
.
sourcepub fn get_purse_balance_result(&self, purse: URef) -> BalanceResult
pub fn get_purse_balance_result(&self, purse: URef) -> BalanceResult
Returns a BalanceResult
for a purse, panics if the balance can’t be found.
sourcepub fn get_public_key_balance_result(
&self,
public_key: PublicKey
) -> BalanceResult
pub fn get_public_key_balance_result( &self, public_key: PublicKey ) -> BalanceResult
Returns a BalanceResult
for a purse using a PublicKey
.
sourcepub fn get_proposer_purse_balance(&self) -> U512
pub fn get_proposer_purse_balance(&self) -> U512
Gets the purse balance of a proposer.
sourcepub fn get_account(&self, account_hash: AccountHash) -> Option<Account>
pub fn get_account(&self, account_hash: AccountHash) -> Option<Account>
Queries for an Account
.
sourcepub fn get_expected_account(&self, account_hash: AccountHash) -> Account
pub fn get_expected_account(&self, account_hash: AccountHash) -> Account
Queries for an Account
and panics if it can’t be found.
sourcepub fn get_contract(&self, contract_hash: ContractHash) -> Option<Contract>
pub fn get_contract(&self, contract_hash: ContractHash) -> Option<Contract>
Queries for a contract by ContractHash
.
sourcepub fn get_contract_wasm(
&self,
contract_hash: ContractHash
) -> Option<ContractWasm>
pub fn get_contract_wasm( &self, contract_hash: ContractHash ) -> Option<ContractWasm>
Queries for a contract by ContractHash
and returns an Option<ContractWasm>
.
sourcepub fn get_contract_package(
&self,
contract_package_hash: ContractPackageHash
) -> Option<ContractPackage>
pub fn get_contract_package( &self, contract_package_hash: ContractPackageHash ) -> Option<ContractPackage>
Queries for a contract package by ContractPackageHash
.
sourcepub fn get_transfer(&self, transfer: TransferAddr) -> Option<Transfer>
pub fn get_transfer(&self, transfer: TransferAddr) -> Option<Transfer>
Queries for a transfer by TransferAddr
.
sourcepub fn get_deploy_info(&self, deploy_hash: DeployHash) -> Option<DeployInfo>
pub fn get_deploy_info(&self, deploy_hash: DeployHash) -> Option<DeployInfo>
Queries for deploy info by DeployHash
.
sourcepub fn exec_costs(&self, index: usize) -> Vec<Gas>
pub fn exec_costs(&self, index: usize) -> Vec<Gas>
Returns a Vec<Gas>
representing execution consts.
sourcepub fn last_exec_gas_cost(&self) -> Gas
pub fn last_exec_gas_cost(&self) -> Gas
Returns the Gas
cost of the last exec.
sourcepub fn last_exec_result(&self) -> &ExecutionResult
pub fn last_exec_result(&self) -> &ExecutionResult
Returns the result of the last exec.
sourcepub fn assert_error(&self, expected_error: Error)
pub fn assert_error(&self, expected_error: Error)
Assert that last error is the expected one.
NOTE: we’re using string-based representation for checking equality
as the Error
type does not implement Eq
(many of its subvariants don’t).
sourcepub fn exec_error_message(&self, index: usize) -> Option<String>
pub fn exec_error_message(&self, index: usize) -> Option<String>
Returns the error message of the last exec.
sourcepub fn get_era_validators(&mut self) -> EraValidators
pub fn get_era_validators(&mut self) -> EraValidators
Gets EraValidators
.
sourcepub fn get_validator_weights(
&mut self,
era_id: EraId
) -> Option<ValidatorWeights>
pub fn get_validator_weights( &mut self, era_id: EraId ) -> Option<ValidatorWeights>
Gets ValidatorWeights
for a given EraId
.
sourcepub fn get_unbonds(&mut self) -> UnbondingPurses
pub fn get_unbonds(&mut self) -> UnbondingPurses
Gets UnbondingPurses
.
sourcepub fn get_withdraw_purses(&mut self) -> WithdrawPurses
pub fn get_withdraw_purses(&mut self) -> WithdrawPurses
Gets WithdrawPurses
.
sourcepub fn get_balance_keys(&self) -> Vec<Key>
pub fn get_balance_keys(&self) -> Vec<Key>
Gets all [Key::Balance]
s in global state.
sourcepub fn get_keys(&self, tag: KeyTag) -> Result<Vec<Key>, S::Error>
pub fn get_keys(&self, tag: KeyTag) -> Result<Vec<Key>, S::Error>
Gets all keys in global state by a prefix.
sourcepub fn get_value<T>(&mut self, contract_hash: ContractHash, name: &str) -> T
pub fn get_value<T>(&mut self, contract_hash: ContractHash, name: &str) -> T
Gets a stored value from a contract’s named keys.
sourcepub fn get_auction_delay(&mut self) -> u64
pub fn get_auction_delay(&mut self) -> u64
Gets the auction delay.
sourcepub fn get_unbonding_delay(&mut self) -> u64
pub fn get_unbonding_delay(&mut self) -> u64
Gets the unbonding delay
sourcepub fn get_system_auction_hash(&self) -> ContractHash
pub fn get_system_auction_hash(&self) -> ContractHash
Gets the ContractHash
of the system auction contract, panics if it can’t be found.
sourcepub fn get_system_mint_hash(&self) -> ContractHash
pub fn get_system_mint_hash(&self) -> ContractHash
Gets the ContractHash
of the system mint contract, panics if it can’t be found.
sourcepub fn get_system_handle_payment_hash(&self) -> ContractHash
pub fn get_system_handle_payment_hash(&self) -> ContractHash
Gets the ContractHash
of the system handle payment contract, panics if it can’t be
found.
sourcepub fn get_system_standard_payment_hash(&self) -> ContractHash
pub fn get_system_standard_payment_hash(&self) -> ContractHash
Returns the ContractHash
of the system standard payment contract, panics if it can’t be
found.
sourcepub fn clear_results(&mut self) -> &mut Self
pub fn clear_results(&mut self) -> &mut Self
Resets the exec_results
, upgrade_results
and transform
fields.
sourcepub fn advance_eras_by(
&mut self,
num_eras: u64,
reward_items: impl IntoIterator<Item = RewardItem>,
evict_items: impl IntoIterator<Item = EvictItem>
)
pub fn advance_eras_by( &mut self, num_eras: u64, reward_items: impl IntoIterator<Item = RewardItem>, evict_items: impl IntoIterator<Item = EvictItem> )
Advances eras by num_eras
sourcepub fn advance_eras_by_default_auction_delay(
&mut self,
reward_items: impl IntoIterator<Item = RewardItem>,
evict_items: impl IntoIterator<Item = EvictItem>
)
pub fn advance_eras_by_default_auction_delay( &mut self, reward_items: impl IntoIterator<Item = RewardItem>, evict_items: impl IntoIterator<Item = EvictItem> )
Advances eras by configured amount
sourcepub fn advance_era(
&mut self,
reward_items: impl IntoIterator<Item = RewardItem>,
evict_items: impl IntoIterator<Item = EvictItem>
)
pub fn advance_era( &mut self, reward_items: impl IntoIterator<Item = RewardItem>, evict_items: impl IntoIterator<Item = EvictItem> )
Advances by a single era.
sourcepub fn get_trie(&mut self, state_hash: Digest) -> Option<Trie<Key, StoredValue>>
pub fn get_trie(&mut self, state_hash: Digest) -> Option<Trie<Key, StoredValue>>
Returns a trie by hash.
sourcepub fn get_auction_costs(&self) -> AuctionCosts
pub fn get_auction_costs(&self) -> AuctionCosts
Returns the costs related to interacting with the auction system contract.
sourcepub fn get_mint_costs(&self) -> MintCosts
pub fn get_mint_costs(&self) -> MintCosts
Returns the costs related to interacting with the mint system contract.
sourcepub fn get_handle_payment_costs(&self) -> HandlePaymentCosts
pub fn get_handle_payment_costs(&self) -> HandlePaymentCosts
Returns the costs related to interacting with the handle payment system contract.
sourcepub fn commit_prune(&mut self, prune_config: PruneConfig) -> &mut Self
pub fn commit_prune(&mut self, prune_config: PruneConfig) -> &mut Self
Commits a prune of leaf nodes from the tip of the merkle trie.
sourcepub fn get_prune_result(
&self,
index: usize
) -> Option<&Result<PruneResult, Error>>
pub fn get_prune_result( &self, index: usize ) -> Option<&Result<PruneResult, Error>>
Returns a Result
containing a PruneResult
.
sourcepub fn expect_prune_success(&mut self) -> &mut Self
pub fn expect_prune_success(&mut self) -> &mut Self
Expects a prune success.
sourcepub fn get_transforms(&self) -> Vec<AdditiveMap<Key, Transform>>
👎Deprecated since 2.1.0: Use get_execution_journals
that returns transforms in the order they were created.
pub fn get_transforms(&self) -> Vec<AdditiveMap<Key, Transform>>
get_execution_journals
that returns transforms in the order they were created.Gets the transform map that’s cached between runs
sourcepub fn get_exec_results(&self) -> &Vec<Vec<Rc<ExecutionResult>>>
👎Deprecated since 2.3.0: use get_last_exec_results
or get_exec_result_owned
instead
pub fn get_exec_results(&self) -> &Vec<Vec<Rc<ExecutionResult>>>
get_last_exec_results
or get_exec_result_owned
insteadReturns the results of all execs.
sourcepub fn get_exec_result(&self, index: usize) -> Option<&Vec<Rc<ExecutionResult>>>
👎Deprecated since 2.3.0: use get_exec_result_owned
instead
pub fn get_exec_result(&self, index: usize) -> Option<&Vec<Rc<ExecutionResult>>>
get_exec_result_owned
insteadReturns the results of a specific exec.
sourcepub fn get_withdraws(&mut self) -> UnbondingPurses
👎Deprecated since 2.3.0: use get_withdraw_purses
instead
pub fn get_withdraws(&mut self) -> UnbondingPurses
get_withdraw_purses
insteadGets UnbondingPurses
.
sourcepub fn calculate_refund_amount(&self, payment_amount: U512) -> U512
pub fn calculate_refund_amount(&self, payment_amount: U512) -> U512
Calculates refunded amount from a last execution request.
Trait Implementations§
Auto Trait Implementations§
impl<S> RefUnwindSafe for WasmTestBuilder<S>where
S: RefUnwindSafe,
impl<S> !Send for WasmTestBuilder<S>
impl<S> !Sync for WasmTestBuilder<S>
impl<S> Unpin for WasmTestBuilder<S>
impl<S> UnwindSafe for WasmTestBuilder<S>where
S: RefUnwindSafe,
Blanket Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.