pub struct ChainHardforks { /* private fields */ }
Expand description
Ordered list of a chain hardforks that implement Hardfork
.
Implementations§
Source§impl ChainHardforks
impl ChainHardforks
Sourcepub fn new(forks: Vec<(Box<dyn Hardfork>, ForkCondition)>) -> Self
pub fn new(forks: Vec<(Box<dyn Hardfork>, ForkCondition)>) -> Self
Creates a new ChainHardforks
from a list which must be ordered by activation.
Equivalent Ethereum hardforks must be included as well.
Sourcepub fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition
pub fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition
Retrieves ForkCondition
from fork
. If fork
is not present, returns
ForkCondition::Never
.
Sourcepub fn get<H: Hardfork>(&self, fork: H) -> Option<ForkCondition>
pub fn get<H: Hardfork>(&self, fork: H) -> Option<ForkCondition>
Retrieves ForkCondition
from fork
if it exists, otherwise None
.
Sourcepub fn fork_block<H: Hardfork>(&self, fork: H) -> Option<u64>
pub fn fork_block<H: Hardfork>(&self, fork: H) -> Option<u64>
Retrieves the fork block number or timestamp from fork
if it exists, otherwise None
.
Sourcepub fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>
pub fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>
Get an iterator of all hardforks with their respective activation conditions.
Sourcepub fn last(&self) -> Option<(Box<dyn Hardfork>, ForkCondition)>
pub fn last(&self) -> Option<(Box<dyn Hardfork>, ForkCondition)>
Get last hardfork from the list.
Sourcepub fn is_fork_active_at_timestamp<H: Hardfork>(
&self,
fork: H,
timestamp: u64,
) -> bool
pub fn is_fork_active_at_timestamp<H: Hardfork>( &self, fork: H, timestamp: u64, ) -> bool
Convenience method to check if a fork is active at a given timestamp.
Sourcepub fn is_fork_active_at_block<H: Hardfork>(
&self,
fork: H,
block_number: u64,
) -> bool
pub fn is_fork_active_at_block<H: Hardfork>( &self, fork: H, block_number: u64, ) -> bool
Convenience method to check if a fork is active at a given block number.
Sourcepub fn insert<H: Hardfork>(&mut self, fork: H, condition: ForkCondition)
pub fn insert<H: Hardfork>(&mut self, fork: H, condition: ForkCondition)
Inserts fork
into list, updating with a new ForkCondition
if it already exists.
Trait Implementations§
Source§impl Clone for ChainHardforks
impl Clone for ChainHardforks
Source§fn clone(&self) -> ChainHardforks
fn clone(&self) -> ChainHardforks
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ChainHardforks
impl Debug for ChainHardforks
Source§impl Default for ChainHardforks
impl Default for ChainHardforks
Source§fn default() -> ChainHardforks
fn default() -> ChainHardforks
Source§impl<const N: usize> From<[(EthereumHardfork, ForkCondition); N]> for ChainHardforks
impl<const N: usize> From<[(EthereumHardfork, ForkCondition); N]> for ChainHardforks
Source§fn from(list: [(EthereumHardfork, ForkCondition); N]) -> Self
fn from(list: [(EthereumHardfork, ForkCondition); N]) -> Self
Source§impl PartialEq for ChainHardforks
impl PartialEq for ChainHardforks
impl Eq for ChainHardforks
impl StructuralPartialEq for ChainHardforks
Auto Trait Implementations§
impl Freeze for ChainHardforks
impl !RefUnwindSafe for ChainHardforks
impl Send for ChainHardforks
impl Sync for ChainHardforks
impl Unpin for ChainHardforks
impl !UnwindSafe for ChainHardforks
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 56 bytes