Struct jormungandr::blockcfg::HeaderBuilder
source · pub struct HeaderBuilder<HeaderBuildingState>(Header, PhantomData<HeaderBuildingState>)
where
HeaderBuildingState: ?Sized;
Expand description
Finalized BFT Header
Tuple Fields§
§0: Header
§1: PhantomData<HeaderBuildingState>
Implementations§
source§impl HeaderBuilder<HeaderSetParenting>
impl HeaderBuilder<HeaderSetParenting>
sourcepub fn new(
version: BlockVersion,
contents: &Contents
) -> HeaderBuilder<HeaderSetParenting>
pub fn new( version: BlockVersion, contents: &Contents ) -> HeaderBuilder<HeaderSetParenting>
Create a new Header builder starting from the full content.
This doesn’t need the content directly, but only uses the content to calculate the content hash and the content size, and make sure this is consistent
sourcepub fn new_raw(
version: BlockVersion,
content_hash: &Hash,
content_size: u32
) -> HeaderBuilder<HeaderSetParenting>
pub fn new_raw( version: BlockVersion, content_hash: &Hash, content_size: u32 ) -> HeaderBuilder<HeaderSetParenting>
recommended to use new(), this is only for test
source§impl HeaderBuilder<HeaderSetParenting>
impl HeaderBuilder<HeaderSetParenting>
sourcepub fn set_genesis(self) -> HeaderBuilder<HeaderSetDate>
pub fn set_genesis(self) -> HeaderBuilder<HeaderSetDate>
Set the header as a genesis header:
- the depth starts at 0
- the parent is set to the “null hash” (hash all 0)
sourcepub fn set_parent(
self,
parent_hash: &Hash,
chain_length: ChainLength
) -> HeaderBuilder<HeaderSetDate>
pub fn set_parent( self, parent_hash: &Hash, chain_length: ChainLength ) -> HeaderBuilder<HeaderSetDate>
Set the header as a general block, with a specific depth and parent hash
source§impl HeaderBuilder<HeaderSetDate>
impl HeaderBuilder<HeaderSetDate>
sourcepub fn set_date(self, date: BlockDate) -> HeaderBuilder<HeaderCommonDone>
pub fn set_date(self, date: BlockDate) -> HeaderBuilder<HeaderCommonDone>
Set the date of this block
source§impl HeaderBuilder<HeaderCommonDone>
impl HeaderBuilder<HeaderCommonDone>
sourcepub fn into_unsigned_header(self) -> Option<HeaderUnsigned>
pub fn into_unsigned_header(self) -> Option<HeaderUnsigned>
Finalized to an unsigned header
sourcepub fn into_bft_builder(
self
) -> Option<HeaderBftBuilder<HeaderSetConsensusData>>
pub fn into_bft_builder( self ) -> Option<HeaderBftBuilder<HeaderSetConsensusData>>
Tentatively transition to a BFT Header builder
sourcepub fn into_genesis_praos_builder(
self
) -> Option<HeaderGenesisPraosBuilder<HeaderSetConsensusData>>
pub fn into_genesis_praos_builder( self ) -> Option<HeaderGenesisPraosBuilder<HeaderSetConsensusData>>
Tentatively transition to a Genesis-Praos Header builder
Auto Trait Implementations§
impl<HeaderBuildingState: ?Sized> RefUnwindSafe for HeaderBuilder<HeaderBuildingState>where HeaderBuildingState: RefUnwindSafe,
impl<HeaderBuildingState: ?Sized> Send for HeaderBuilder<HeaderBuildingState>where HeaderBuildingState: Send,
impl<HeaderBuildingState: ?Sized> Sync for HeaderBuilder<HeaderBuildingState>where HeaderBuildingState: Sync,
impl<HeaderBuildingState: ?Sized> Unpin for HeaderBuilder<HeaderBuildingState>where HeaderBuildingState: Unpin,
impl<HeaderBuildingState: ?Sized> UnwindSafe for HeaderBuilder<HeaderBuildingState>where HeaderBuildingState: UnwindSafe,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request