DatabaseCommit

Trait DatabaseCommit 

Source
pub trait DatabaseCommit {
    // Required method
    fn commit(&mut self, changes: HashMap<Address, Account>);

    // Provided method
    fn commit_iter(
        &mut self,
        changes: &mut dyn Iterator<Item = (Address, Account)>,
    ) { ... }
}
Expand description

EVM database commit interface.

§Dyn Compatibility

This trait is dyn-compatible. The commit_iter method uses &mut dyn Iterator which allows it to be called on trait objects while remaining in the vtable.

Required Methods§

Source

fn commit(&mut self, changes: HashMap<Address, Account>)

Commit changes to the database.

Provided Methods§

Source

fn commit_iter(&mut self, changes: &mut dyn Iterator<Item = (Address, Account)>)

Commit changes to the database with an iterator.

Implementors of DatabaseCommit should override this method when possible for efficiency.

Callers should prefer using DatabaseCommit::commit when they already have a [HashMap].

§Dyn Compatibility

This method uses &mut dyn Iterator to remain object-safe and callable on trait objects. For ergonomic usage with impl IntoIterator, use the inherent method commit_from_iter on dyn DatabaseCommit.

Implementations§

Source§

impl dyn DatabaseCommit

Inherent implementation for dyn DatabaseCommit trait objects.

This provides commit_from_iter as an ergonomic wrapper around the trait’s commit_iter method, accepting impl IntoIterator for convenience.

Source

pub fn commit_from_iter( &mut self, changes: impl IntoIterator<Item = (Address, Account)>, )

Commit changes to the database with an iterator.

This is an ergonomic wrapper that accepts impl IntoIterator and delegates to the trait’s commit_iter method.

Implementations on Foreign Types§

Source§

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

Source§

fn commit(&mut self, changes: HashMap<Address, Account>)

Source§

fn commit_iter(&mut self, changes: &mut dyn Iterator<Item = (Address, Account)>)

Source§

impl<L, R> DatabaseCommit for Either<L, R>

Source§

fn commit(&mut self, changes: HashMap<Address, Account>)

Source§

impl<T: DatabaseCommit + ?Sized> DatabaseCommit for Box<T>

Source§

fn commit(&mut self, changes: HashMap<Address, Account>)

Source§

fn commit_iter(&mut self, changes: &mut dyn Iterator<Item = (Address, Account)>)

Implementors§