Enum alloy_eips::eip1898::BlockId
source · pub enum BlockId {
Hash(RpcBlockHash),
Number(BlockNumberOrTag),
}
Expand description
A Block Identifier. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1898.md
Variants§
Hash(RpcBlockHash)
A block hash and an optional bool that defines if it’s canonical
Number(BlockNumberOrTag)
A block number
Implementations§
source§impl BlockId
impl BlockId
sourcepub const fn as_block_hash(&self) -> Option<BlockHash>
pub const fn as_block_hash(&self) -> Option<BlockHash>
Returns the block hash if it is BlockId::Hash
sourcepub const fn as_u64(&self) -> Option<u64>
pub const fn as_u64(&self) -> Option<u64>
Returns the block number if it is BlockId::Number
and not a tag
sourcepub const fn is_latest(&self) -> bool
pub const fn is_latest(&self) -> bool
Returns true if this is BlockNumberOrTag::Latest
sourcepub const fn is_pending(&self) -> bool
pub const fn is_pending(&self) -> bool
Returns true if this is BlockNumberOrTag::Pending
sourcepub const fn is_safe(&self) -> bool
pub const fn is_safe(&self) -> bool
Returns true if this is BlockNumberOrTag::Safe
sourcepub const fn is_finalized(&self) -> bool
pub const fn is_finalized(&self) -> bool
Returns true if this is BlockNumberOrTag::Finalized
sourcepub const fn is_earliest(&self) -> bool
pub const fn is_earliest(&self) -> bool
Returns true if this is BlockNumberOrTag::Earliest
sourcepub const fn is_number(&self) -> bool
pub const fn is_number(&self) -> bool
Returns true if this is BlockNumberOrTag::Number
sourcepub const fn is_hash(&self) -> bool
pub const fn is_hash(&self) -> bool
Returns true if this is BlockId::Hash
sourcepub const fn hash_canonical(block_hash: BlockHash) -> Self
pub const fn hash_canonical(block_hash: BlockHash) -> Self
Create a new block hash instance that requires the block to be canonical.
Trait Implementations§
source§impl<'de> Deserialize<'de> for BlockId
impl<'de> Deserialize<'de> for BlockId
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<BlockNumberOrTag> for BlockId
impl From<BlockNumberOrTag> for BlockId
source§fn from(num: BlockNumberOrTag) -> Self
fn from(num: BlockNumberOrTag) -> Self
Converts to this type from the input type.
source§impl From<FixedBytes<32>> for BlockId
impl From<FixedBytes<32>> for BlockId
source§impl From<HashOrNumber> for BlockId
impl From<HashOrNumber> for BlockId
source§fn from(block: HashOrNumber) -> Self
fn from(block: HashOrNumber) -> Self
Converts to this type from the input type.
source§impl From<RpcBlockHash> for BlockId
impl From<RpcBlockHash> for BlockId
source§fn from(value: RpcBlockHash) -> Self
fn from(value: RpcBlockHash) -> Self
Converts to this type from the input type.
source§impl PartialEq for BlockId
impl PartialEq for BlockId
impl Copy for BlockId
impl Eq for BlockId
impl StructuralPartialEq for BlockId
Auto Trait Implementations§
impl Freeze for BlockId
impl RefUnwindSafe for BlockId
impl Send for BlockId
impl Sync for BlockId
impl Unpin for BlockId
impl UnwindSafe for BlockId
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.