pub struct AnyRpcBlock(pub WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>);
Available on crate feature
network
only.Expand description
A wrapper for AnyRpcBlock
that allows for handling unknown block types.
This type wraps:
- rpc transaction
- additional fields
Tuple Fields§
§0: WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
Implementations§
Source§impl AnyRpcBlock
impl AnyRpcBlock
Sourcepub fn new(
inner: WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>,
) -> AnyRpcBlock
pub fn new( inner: WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>, ) -> AnyRpcBlock
Create a new AnyRpcBlock
.
Sourcepub fn into_inner(self) -> Block<AnyRpcTransaction, Header<AnyHeader>>
pub fn into_inner(self) -> Block<AnyRpcTransaction, Header<AnyHeader>>
Consumes the type and returns the wrapped rpc block.
Sourcepub fn try_into_transactions(
self,
) -> Result<Vec<AnyRpcTransaction>, ValueError<BlockTransactions<AnyRpcTransaction>>>
pub fn try_into_transactions( self, ) -> Result<Vec<AnyRpcTransaction>, ValueError<BlockTransactions<AnyRpcTransaction>>>
Tries to convert inner transactions into a vector of AnyRpcTransaction
.
Returns an error if the block contains only transaction hashes or if it is an uncle block.
Sourcepub fn into_transactions_iter(self) -> impl Iterator<Item = AnyRpcTransaction>
pub fn into_transactions_iter(self) -> impl Iterator<Item = AnyRpcTransaction>
Consumes the type and returns an iterator over the transactions in this block
Methods from Deref<Target = WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>>§
Trait Implementations§
Source§impl AsRef<WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>> for AnyRpcBlock
impl AsRef<WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>> for AnyRpcBlock
Source§fn as_ref(
&self,
) -> &WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
fn as_ref( &self, ) -> &WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl BlockResponse for AnyRpcBlock
impl BlockResponse for AnyRpcBlock
Source§type Transaction = AnyRpcTransaction
type Transaction = AnyRpcTransaction
Transaction type
Source§fn header(&self) -> &<AnyRpcBlock as BlockResponse>::Header
fn header(&self) -> &<AnyRpcBlock as BlockResponse>::Header
Block header
Source§fn transactions(
&self,
) -> &BlockTransactions<<AnyRpcBlock as BlockResponse>::Transaction>
fn transactions( &self, ) -> &BlockTransactions<<AnyRpcBlock as BlockResponse>::Transaction>
Block transactions
Source§fn transactions_mut(
&mut self,
) -> &mut BlockTransactions<<AnyRpcBlock as BlockResponse>::Transaction>
fn transactions_mut( &mut self, ) -> &mut BlockTransactions<<AnyRpcBlock as BlockResponse>::Transaction>
Mutable reference to block transactions
Source§fn other_fields(&self) -> Option<&OtherFields>
fn other_fields(&self) -> Option<&OtherFields>
Returns the
other
field from WithOtherFields
type.Source§impl Clone for AnyRpcBlock
impl Clone for AnyRpcBlock
Source§fn clone(&self) -> AnyRpcBlock
fn clone(&self) -> AnyRpcBlock
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 AnyRpcBlock
impl Debug for AnyRpcBlock
Source§impl Deref for AnyRpcBlock
impl Deref for AnyRpcBlock
Source§type Target = WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
type Target = WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
The resulting type after dereferencing.
Source§impl DerefMut for AnyRpcBlock
impl DerefMut for AnyRpcBlock
Source§impl<'de> Deserialize<'de> for AnyRpcBlock
impl<'de> Deserialize<'de> for AnyRpcBlock
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnyRpcBlock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnyRpcBlock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AnyRpcBlock> for WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
impl From<AnyRpcBlock> for WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
Source§fn from(
value: AnyRpcBlock,
) -> WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
fn from( value: AnyRpcBlock, ) -> WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>
Converts to this type from the input type.
Source§impl From<Block> for AnyRpcBlock
impl From<Block> for AnyRpcBlock
Source§fn from(value: Block) -> AnyRpcBlock
fn from(value: Block) -> AnyRpcBlock
Converts to this type from the input type.
Source§impl From<WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>> for AnyRpcBlock
impl From<WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>> for AnyRpcBlock
Source§fn from(
value: WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>,
) -> AnyRpcBlock
fn from( value: WithOtherFields<Block<AnyRpcTransaction, Header<AnyHeader>>>, ) -> AnyRpcBlock
Converts to this type from the input type.
Source§impl PartialEq for AnyRpcBlock
impl PartialEq for AnyRpcBlock
Source§impl Serialize for AnyRpcBlock
impl Serialize for AnyRpcBlock
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for AnyRpcBlock
impl StructuralPartialEq for AnyRpcBlock
Auto Trait Implementations§
impl !Freeze for AnyRpcBlock
impl RefUnwindSafe for AnyRpcBlock
impl Send for AnyRpcBlock
impl Sync for AnyRpcBlock
impl Unpin for AnyRpcBlock
impl UnwindSafe for AnyRpcBlock
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§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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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