pub struct BlockInfo {
pub state_hash: Digest,
pub block_time: BlockTime,
pub parent_block_hash: BlockHash,
pub block_height: u64,
pub protocol_version: ProtocolVersion,
}Expand description
Block info.
Fields§
§state_hash: DigestState root hash of the global state in which the transaction will be executed.
block_time: BlockTimeBlock time represented as a unix timestamp.
parent_block_hash: BlockHashParent block hash
block_height: u64Block height
protocol_version: ProtocolVersionProtocol version
Implementations§
Source§impl BlockInfo
impl BlockInfo
Sourcepub fn new(
state_hash: Digest,
block_time: BlockTime,
parent_block_hash: BlockHash,
block_height: u64,
protocol_version: ProtocolVersion,
) -> Self
pub fn new( state_hash: Digest, block_time: BlockTime, parent_block_hash: BlockHash, block_height: u64, protocol_version: ProtocolVersion, ) -> Self
A new instance of [BlockInfo].
Sourcepub fn with_state_hash(&mut self, state_hash: Digest)
pub fn with_state_hash(&mut self, state_hash: Digest)
Apply different state hash.
Sourcepub fn state_hash(&self) -> Digest
pub fn state_hash(&self) -> Digest
State hash.
Sourcepub fn block_time(&self) -> BlockTime
pub fn block_time(&self) -> BlockTime
Block time.
Sourcepub fn parent_block_hash(&self) -> BlockHash
pub fn parent_block_hash(&self) -> BlockHash
Parent block hash.
Sourcepub fn block_height(&self) -> u64
pub fn block_height(&self) -> u64
Block height.
Sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Protocol version.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockInfo
impl RefUnwindSafe for BlockInfo
impl Send for BlockInfo
impl Sync for BlockInfo
impl Unpin for BlockInfo
impl UnwindSafe for BlockInfo
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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