Trait ContextTr

pub trait ContextTr {
    type Block: Block;
    type Tx: Transaction;
    type Cfg: Cfg;
    type Db: Database;
    type Journal: JournalTr<Database = Self::Db>;
    type Chain;

    // Required methods
    fn tx(&self) -> &Self::Tx;
    fn block(&self) -> &Self::Block;
    fn cfg(&self) -> &Self::Cfg;
    fn journal(&mut self) -> &mut Self::Journal;
    fn journal_ref(&self) -> &Self::Journal;
    fn db(&mut self) -> &mut Self::Db;
    fn db_ref(&self) -> &Self::Db;
    fn chain(&mut self) -> &mut Self::Chain;
    fn error(
        &mut self,
    ) -> &mut Result<(), ContextError<<Self::Db as Database>::Error>>;
    fn tx_journal(&mut self) -> (&mut Self::Tx, &mut Self::Journal);
}
Expand description

Trait that defines the context of the EVM execution.

This trait is used to access the environment and state of the EVM. It is used to access the transaction, block, configuration, database, journal, and chain. It is also used to set the error of the EVM.

Required Associated Types§

type Block: Block

Block type

type Tx: Transaction

Transaction type

type Cfg: Cfg

Configuration type

type Db: Database

Database type

type Journal: JournalTr<Database = Self::Db>

Journal type

type Chain

Chain type

Required Methods§

fn tx(&self) -> &Self::Tx

Get the transaction

fn block(&self) -> &Self::Block

Get the block

fn cfg(&self) -> &Self::Cfg

Get the configuration

fn journal(&mut self) -> &mut Self::Journal

Get the journal

fn journal_ref(&self) -> &Self::Journal

Get the journal reference

fn db(&mut self) -> &mut Self::Db

Get the database

fn db_ref(&self) -> &Self::Db

Get the database reference

fn chain(&mut self) -> &mut Self::Chain

Get the chain

fn error( &mut self, ) -> &mut Result<(), ContextError<<Self::Db as Database>::Error>>

Get the error

fn tx_journal(&mut self) -> (&mut Self::Tx, &mut Self::Journal)

Get the transaction and journal. It is used to efficiently load access list into journal without copying them from transaction.

Implementations on Foreign Types§

§

impl<'a, T> ContextTr for &'a mut T
where T: 'a + ContextTr + ?Sized,

§

type Block = <T as ContextTr>::Block

§

type Tx = <T as ContextTr>::Tx

§

type Cfg = <T as ContextTr>::Cfg

§

type Db = <T as ContextTr>::Db

§

type Journal = <T as ContextTr>::Journal

§

type Chain = <T as ContextTr>::Chain

§

fn tx(&self) -> &<&'a mut T as ContextTr>::Tx

§

fn block(&self) -> &<&'a mut T as ContextTr>::Block

§

fn cfg(&self) -> &<&'a mut T as ContextTr>::Cfg

§

fn journal(&mut self) -> &mut <&'a mut T as ContextTr>::Journal

§

fn journal_ref(&self) -> &<&'a mut T as ContextTr>::Journal

§

fn db(&mut self) -> &mut <&'a mut T as ContextTr>::Db

§

fn db_ref(&self) -> &<&'a mut T as ContextTr>::Db

§

fn chain(&mut self) -> &mut <&'a mut T as ContextTr>::Chain

§

fn error( &mut self, ) -> &mut Result<(), ContextError<<<&'a mut T as ContextTr>::Db as Database>::Error>>

§

fn tx_journal( &mut self, ) -> (&mut <&'a mut T as ContextTr>::Tx, &mut <&'a mut T as ContextTr>::Journal)

§

impl<T> ContextTr for Box<T>
where T: ContextTr + ?Sized,

§

type Block = <T as ContextTr>::Block

§

type Tx = <T as ContextTr>::Tx

§

type Cfg = <T as ContextTr>::Cfg

§

type Db = <T as ContextTr>::Db

§

type Journal = <T as ContextTr>::Journal

§

type Chain = <T as ContextTr>::Chain

§

fn tx(&self) -> &<Box<T> as ContextTr>::Tx

§

fn block(&self) -> &<Box<T> as ContextTr>::Block

§

fn cfg(&self) -> &<Box<T> as ContextTr>::Cfg

§

fn journal(&mut self) -> &mut <Box<T> as ContextTr>::Journal

§

fn journal_ref(&self) -> &<Box<T> as ContextTr>::Journal

§

fn db(&mut self) -> &mut <Box<T> as ContextTr>::Db

§

fn db_ref(&self) -> &<Box<T> as ContextTr>::Db

§

fn chain(&mut self) -> &mut <Box<T> as ContextTr>::Chain

§

fn error( &mut self, ) -> &mut Result<(), ContextError<<<Box<T> as ContextTr>::Db as Database>::Error>>

§

fn tx_journal( &mut self, ) -> (&mut <Box<T> as ContextTr>::Tx, &mut <Box<T> as ContextTr>::Journal)

Implementors§

§

impl<BLOCK, TX, DB, CFG, JOURNAL, CHAIN> ContextTr for Context<BLOCK, TX, CFG, DB, JOURNAL, CHAIN>
where BLOCK: Block, TX: Transaction, DB: Database, CFG: Cfg, JOURNAL: JournalTr<Database = DB>,

§

type Block = BLOCK

§

type Tx = TX

§

type Cfg = CFG

§

type Db = DB

§

type Journal = JOURNAL

§

type Chain = CHAIN