Skip to main content

Hook

Trait Hook 

Source
pub trait Hook {
    // Required methods
    fn prepare_execution(&mut self, vm: &mut VM<'_>) -> Result<(), VMError>;
    fn finalize_execution(
        &mut self,
        vm: &mut VM<'_>,
        report: &mut ContextResult,
    ) -> Result<(), VMError>;

    // Provided method
    fn reads_top_level_backup(&self) -> bool { ... }
}

Required Methods§

Source

fn prepare_execution(&mut self, vm: &mut VM<'_>) -> Result<(), VMError>

Source

fn finalize_execution( &mut self, vm: &mut VM<'_>, report: &mut ContextResult, ) -> Result<(), VMError>

Provided Methods§

Source

fn reads_top_level_backup(&self) -> bool

True iff this hook reads the top-level call-frame backup (db.tx_backup) in finalize_execution. Drives VM::preserve_top_level_backup: when any installed hook returns true, the backup is deep-cloned (not moved out) on the revert / invalid-tx paths so the hook still sees it. Defaults to false; only BackupHook overrides it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§