ab_system_contract_state

Trait StateExt

Source
pub trait StateExt {
    // Required methods
    fn state_write(
        self: &&mut Self,
        method_context: &MethodContext,
        contract: &Address,
        contract_state: &Address,
        new_state: &VariableBytes<MAX_STATE_SIZE>,
    ) -> Result<(), ContractError>;
    fn state_read(
        &self,
        contract: &Address,
        contract_state: &Address,
        state: &mut VariableBytes<MAX_STATE_SIZE>,
    ) -> Result<(), ContractError>;
    fn state_is_empty(
        &self,
        contract: &Address,
        contract_state: &Address,
    ) -> Result<bool, ContractError>;
}
Expand description

Extension trait that provides helper methods for calling State’s methods on Env for convenience purposes

Required Methods§

Source

fn state_write( self: &&mut Self, method_context: &MethodContext, contract: &Address, contract_state: &Address, new_state: &VariableBytes<MAX_STATE_SIZE>, ) -> Result<(), ContractError>

Source

fn state_read( &self, contract: &Address, contract_state: &Address, state: &mut VariableBytes<MAX_STATE_SIZE>, ) -> Result<(), ContractError>

Source

fn state_is_empty( &self, contract: &Address, contract_state: &Address, ) -> Result<bool, ContractError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl StateExt for Env

Source§

fn state_write( self: &&mut Self, method_context: &MethodContext, contract: &Address, contract_state: &Address, new_state: &VariableBytes<MAX_STATE_SIZE>, ) -> Result<(), ContractError>

Source§

fn state_read( &self, contract: &Address, contract_state: &Address, state: &mut VariableBytes<MAX_STATE_SIZE>, ) -> Result<(), ContractError>

Source§

fn state_is_empty( &self, contract: &Address, contract_state: &Address, ) -> Result<bool, ContractError>

Implementors§