Skip to main content

HashedPostStateCursor

Struct HashedPostStateCursor 

Source
pub struct HashedPostStateCursor<'a, C, V>{ /* private fields */ }
Expand description

A cursor to iterate over state updates and corresponding database entries. It will always give precedence to the data from the post state updates.

Implementations§

Source§

impl<'a, C> HashedPostStateCursor<'a, C, Option<Account>>
where C: HashedCursor<Value = Account>,

Source

pub fn new_account(cursor: C, post_state: &'a HashedPostStateSorted) -> Self

Create new account cursor which combines a DB cursor and the post state.

Source§

impl<'a, C> HashedPostStateCursor<'a, C, U256>
where C: HashedStorageCursor<Value = U256>,

Source

pub fn new_storage( cursor: C, post_state: &'a HashedPostStateSorted, hashed_address: B256, ) -> Self

Create new storage cursor with full post state reference. This allows the cursor to switch between storage tries when set_hashed_address is called.

Trait Implementations§

Source§

impl<'a, C: Debug, V> Debug for HashedPostStateCursor<'a, C, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, V> HashedCursor for HashedPostStateCursor<'_, C, V>

Source§

fn seek( &mut self, key: B256, ) -> Result<Option<(B256, Self::Value)>, DatabaseError>

Seek the next entry for a given hashed key.

If the post state contains the exact match for the key, return it. Otherwise, retrieve the next entries that are greater than or equal to the key from the database and the post state. The two entries are compared and the lowest is returned.

The returned account key is memoized and the cursor remains positioned at that key until HashedCursor::seek or HashedCursor::next are called.

Source§

fn next(&mut self) -> Result<Option<(B256, Self::Value)>, DatabaseError>

Retrieve the next entry from the cursor.

If the cursor is positioned at the entry, return the entry with next greater key. Returns None if the previous memoized or the next greater entries are missing.

NOTE: This function will not return any entry unless HashedCursor::seek has been called.

Source§

type Value = <V as HashedPostStateCursorValue>::NonZero

Value returned by the cursor.
Source§

fn reset(&mut self)

Reset the cursor to its initial state. Read more
Source§

impl<C> HashedStorageCursor for HashedPostStateCursor<'_, C, U256>
where C: HashedStorageCursor<Value = U256>,

The cursor to iterate over post state hashed values and corresponding database entries. It will always give precedence to the data from the post state.

Source§

fn is_storage_empty(&mut self) -> Result<bool, DatabaseError>

Returns true if the account has no storage entries.

This function should be called before attempting to call HashedCursor::seek or HashedCursor::next.

Source§

fn set_hashed_address(&mut self, hashed_address: B256)

Set the hashed address for the storage cursor. Read more

Auto Trait Implementations§

§

impl<'a, C, V> Freeze for HashedPostStateCursor<'a, C, V>
where C: Freeze, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: Freeze, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: Freeze,

§

impl<'a, C, V> RefUnwindSafe for HashedPostStateCursor<'a, C, V>
where C: RefUnwindSafe, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: RefUnwindSafe, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: RefUnwindSafe,

§

impl<'a, C, V> Send for HashedPostStateCursor<'a, C, V>
where C: Send, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: Send, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: Send,

§

impl<'a, C, V> Sync for HashedPostStateCursor<'a, C, V>
where C: Sync, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: Sync, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: Sync,

§

impl<'a, C, V> Unpin for HashedPostStateCursor<'a, C, V>
where C: Unpin, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: Unpin, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: Unpin,

§

impl<'a, C, V> UnsafeUnpin for HashedPostStateCursor<'a, C, V>
where C: UnsafeUnpin, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: UnsafeUnpin, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: UnsafeUnpin,

§

impl<'a, C, V> UnwindSafe for HashedPostStateCursor<'a, C, V>
where C: UnwindSafe, DbCursorState<<V as HashedPostStateCursorValue>::NonZero>: UnwindSafe, ForwardInMemoryCursor<'a, FixedBytes<32>, V>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> MaybeDebug for T
where T: Debug,

§

impl<T> NonStaticAny for T
where T: ?Sized,

§

fn type_id(&self) -> TypeId

Returns the lifetime-erased type ID of self.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.