Struct ethereum_forkid::ForkFilter
source · [−]pub struct ForkFilter { /* private fields */ }
Expand description
Filter that describes the state of blockchain and can be used to check incoming ForkId
s for compatibility.
Implementations
sourceimpl ForkFilter
impl ForkFilter
sourcepub fn new<F>(head: BlockNumber, genesis: H256, forks: F) -> Self where
F: IntoIterator<Item = BlockNumber>,
pub fn new<F>(head: BlockNumber, genesis: H256, forks: F) -> Self where
F: IntoIterator<Item = BlockNumber>,
Create the filter from provided head, genesis block hash, past forks and expected future forks.
sourcepub fn set_head(&mut self, head: BlockNumber)
pub fn set_head(&mut self, head: BlockNumber)
Set the current head
sourcepub fn is_compatible(&self, fork_id: ForkId) -> Result<(), RejectReason>
pub fn is_compatible(&self, fork_id: ForkId) -> Result<(), RejectReason>
Check whether the provided ForkId
is compatible based on the validation rules in EIP-2124
.
Errors
Returns a RejectReason
if the ForkId
is not compatible.
Trait Implementations
sourceimpl Clone for ForkFilter
impl Clone for ForkFilter
sourcefn clone(&self) -> ForkFilter
fn clone(&self) -> ForkFilter
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ForkFilter
impl Debug for ForkFilter
sourceimpl MallocSizeOf for ForkFilter
impl MallocSizeOf for ForkFilter
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
sourceimpl PartialEq<ForkFilter> for ForkFilter
impl PartialEq<ForkFilter> for ForkFilter
sourcefn eq(&self, other: &ForkFilter) -> bool
fn eq(&self, other: &ForkFilter) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ForkFilter) -> bool
fn ne(&self, other: &ForkFilter) -> bool
This method tests for !=
.
impl StructuralPartialEq for ForkFilter
Auto Trait Implementations
impl RefUnwindSafe for ForkFilter
impl Send for ForkFilter
impl Sync for ForkFilter
impl Unpin for ForkFilter
impl UnwindSafe for ForkFilter
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