Struct common_types::encoded::Block
source · [−]pub struct Block(_);
Expand description
Owning block view.
Implementations
sourceimpl Block
impl Block
sourcepub fn new(raw: Vec<u8>) -> Self
pub fn new(raw: Vec<u8>) -> Self
Create a new owning block view. The raw bytes passed in must be an rlp-encoded block.
sourcepub fn new_from_header_and_body(
header: &HeaderView<'_>,
body: &BodyView<'_>
) -> Self
pub fn new_from_header_and_body(
header: &HeaderView<'_>,
body: &BodyView<'_>
) -> Self
Create a new owning block view by concatenating the encoded header and body
sourcepub fn header_view(&self) -> HeaderView<'_>
pub fn header_view(&self) -> HeaderView<'_>
Get a borrowed view of the block header.
sourcepub fn decode(
&self,
eip1559_transition: BlockNumber
) -> Result<FullBlock, DecoderError>
pub fn decode(
&self,
eip1559_transition: BlockNumber
) -> Result<FullBlock, DecoderError>
Decode to a full block.
sourcepub fn decode_header(&self, eip1559_transition: BlockNumber) -> FullHeader
pub fn decode_header(&self, eip1559_transition: BlockNumber) -> FullHeader
Decode the header.
sourcepub fn into_inner(self) -> Vec<u8>
pub fn into_inner(self) -> Vec<u8>
Consume the view and return the raw bytes.
sourceimpl Block
impl Block
sourcepub fn parent_hash(&self) -> H256
pub fn parent_hash(&self) -> H256
Returns the parent hash.
sourcepub fn uncles_hash(&self) -> H256
pub fn uncles_hash(&self) -> H256
Returns the uncles hash.
Returns the author.
sourcepub fn state_root(&self) -> H256
pub fn state_root(&self) -> H256
Returns the state root.
sourcepub fn transactions_root(&self) -> H256
pub fn transactions_root(&self) -> H256
Returns the transaction trie root.
sourcepub fn receipts_root(&self) -> H256
pub fn receipts_root(&self) -> H256
Returns the receipts trie root
sourcepub fn difficulty(&self) -> U256
pub fn difficulty(&self) -> U256
Difficulty of this block
sourcepub fn number(&self) -> BlockNumber
pub fn number(&self) -> BlockNumber
Number of this block.
sourcepub fn extra_data(&self) -> Vec<u8>
pub fn extra_data(&self) -> Vec<u8>
Block extra data.
sourceimpl Block
impl Block
sourcepub fn transactions(&self) -> Vec<UnverifiedTransaction>
pub fn transactions(&self) -> Vec<UnverifiedTransaction>
Get a vector of all transactions.
sourcepub fn transactions_count(&self) -> usize
pub fn transactions_count(&self) -> usize
Number of transactions in the block.
sourcepub fn transaction_views(&self) -> Vec<TypedTransactionView<'_>>
pub fn transaction_views(&self) -> Vec<TypedTransactionView<'_>>
A view over each transaction in the block.
sourcepub fn transaction_hashes(&self) -> Vec<H256>
pub fn transaction_hashes(&self) -> Vec<H256>
The hash of each transaction in the block.
sourcepub fn uncles(&self, eip1559_transition: BlockNumber) -> Vec<FullHeader>
pub fn uncles(&self, eip1559_transition: BlockNumber) -> Vec<FullHeader>
Decode uncle headers.
sourcepub fn uncles_count(&self) -> usize
pub fn uncles_count(&self) -> usize
Number of uncles.
sourcepub fn uncle_views(&self) -> Vec<HeaderView<'_>>
pub fn uncle_views(&self) -> Vec<HeaderView<'_>>
Borrowed view over each uncle.
sourcepub fn uncle_hashes(&self) -> Vec<H256>
pub fn uncle_hashes(&self) -> Vec<H256>
Hash of each uncle.
Trait Implementations
sourceimpl MallocSizeOf for Block
impl MallocSizeOf for Block
sourcefn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
If T::size_of
is a constant, consider implementing constant_size
as well. Read more
sourcefn constant_size() -> Option<usize>
fn constant_size() -> Option<usize>
Used to optimize MallocSizeOf
implementation for collections
like Vec
and HashMap
to avoid iterating over them unnecessarily.
The Self: Sized
bound is for object safety. Read more
impl Eq for Block
impl StructuralEq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
impl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
sourcefn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Method to launch a heapsize measurement with a fresh state. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more