Struct common_types::encoded::Header
source · [−]pub struct Header(_);
Expand description
Owning header view.
Implementations
sourceimpl Header
impl Header
sourcepub fn new(encoded: Vec<u8>) -> Self
pub fn new(encoded: Vec<u8>) -> Self
Create a new owning header view. Expects the data to be an RLP-encoded header – any other case will likely lead to panics further down the line.
sourcepub fn decode(
&self,
eip1559_transition: BlockNumber
) -> Result<FullHeader, DecoderError>
pub fn decode(
&self,
eip1559_transition: BlockNumber
) -> Result<FullHeader, DecoderError>
Upgrade this encoded view to a fully owned Header
object.
sourcepub fn view(&self) -> HeaderView<'_>
pub fn view(&self) -> HeaderView<'_>
Get a borrowed header view onto the data.
sourcepub fn into_inner(self) -> Vec<u8>
pub fn into_inner(self) -> Vec<u8>
Consume the view and return the raw bytes.
sourceimpl Header
impl Header
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.
Trait Implementations
sourceimpl MallocSizeOf for Header
impl MallocSizeOf for Header
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 Header
impl StructuralEq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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