pub enum HashOrNumber {
Hash(B256),
Number(u64),
}
Expand description
Either a hash or a block number
Variants§
Implementations§
Source§impl HashOrNumber
impl HashOrNumber
Sourcepub const fn as_number(self) -> Option<u64>
pub const fn as_number(self) -> Option<u64>
Returns the block number if it is a HashOrNumber::Number
.
Sourcepub const fn as_hash(self) -> Option<B256>
pub const fn as_hash(self) -> Option<B256>
Returns the block hash if it is a HashOrNumber::Hash
.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for HashOrNumber
impl<'arbitrary> Arbitrary<'arbitrary> for HashOrNumber
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§impl Clone for HashOrNumber
impl Clone for HashOrNumber
Source§fn clone(&self) -> HashOrNumber
fn clone(&self) -> HashOrNumber
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HashOrNumber
impl Debug for HashOrNumber
Source§impl Decodable for HashOrNumber
impl Decodable for HashOrNumber
Allows for RLP decoding of a hash or number
Source§impl<'de> Deserialize<'de> for HashOrNumber
impl<'de> Deserialize<'de> for HashOrNumber
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 Display for HashOrNumber
impl Display for HashOrNumber
Source§impl Encodable for HashOrNumber
impl Encodable for HashOrNumber
Allows for RLP encoding of either a hash or a number
Source§impl From<&FixedBytes<32>> for HashOrNumber
impl From<&FixedBytes<32>> for HashOrNumber
Source§impl From<FixedBytes<32>> for HashOrNumber
impl From<FixedBytes<32>> for HashOrNumber
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 HashOrNumber
impl From<RpcBlockHash> for HashOrNumber
Source§fn from(value: RpcBlockHash) -> Self
fn from(value: RpcBlockHash) -> Self
Converts to this type from the input type.
Source§impl From<Uint<64, 1>> for HashOrNumber
impl From<Uint<64, 1>> for HashOrNumber
Source§impl From<u64> for HashOrNumber
impl From<u64> for HashOrNumber
Source§impl FromStr for HashOrNumber
impl FromStr for HashOrNumber
Source§impl Hash for HashOrNumber
impl Hash for HashOrNumber
Source§impl PartialEq for HashOrNumber
impl PartialEq for HashOrNumber
Source§impl Serialize for HashOrNumber
impl Serialize for HashOrNumber
impl Copy for HashOrNumber
impl Eq for HashOrNumber
impl StructuralPartialEq for HashOrNumber
Auto Trait Implementations§
impl Freeze for HashOrNumber
impl RefUnwindSafe for HashOrNumber
impl Send for HashOrNumber
impl Sync for HashOrNumber
impl Unpin for HashOrNumber
impl UnwindSafe for HashOrNumber
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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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