DatabaseCommit

Trait DatabaseCommit 

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

    // 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, DefaultHashBuilder>)

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> DatabaseCommit for &'a mut T
where T: 'a + DatabaseCommit + ?Sized,

Source§

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

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, DefaultHashBuilder>)

Source§

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

Source§

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

Source§

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

Implementors§