HashedPostStateCursorValue

Trait HashedPostStateCursorValue 

Source
pub trait HashedPostStateCursorValue: Copy {
    type NonZero: Copy + Debug;

    // Required method
    fn into_option(self) -> Option<Self::NonZero>;
}
Expand description

Trait for types that can be used with HashedPostStateCursor as a value.

This enables uniform handling of deletions across different wrapper types:

  • Option<Account>: None indicates deletion
  • U256: U256::ZERO indicates deletion (maps to None)

This design allows us to use U256::ZERO, rather than an Option, to indicate deletion for storage (which maps cleanly to how changesets are stored in the DB) while not requiring two different cursor implementations.

Required Associated Types§

Source

type NonZero: Copy + Debug

The non-zero type returned by into_option. For Option<Account>, this is Account. For U256, this is U256.

Required Methods§

Source

fn into_option(self) -> Option<Self::NonZero>

Returns Some(&NonZero) if the value is present, None if deleted.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl HashedPostStateCursorValue for Option<Account>

Source§

type NonZero = Account

Source§

fn into_option(self) -> Option<Self::NonZero>

Source§

impl HashedPostStateCursorValue for U256

Source§

type NonZero = Uint<256, 4>

Source§

fn into_option(self) -> Option<Self::NonZero>

Implementors§