pub struct InvalidBlockSelection(/* private fields */);
Expand description
Describes the invalid block hooks that should be installed.
§Example
Create a InvalidBlockSelection
from a selection.
use reth_node_core::args::{InvalidBlockHookType, InvalidBlockSelection};
let config: InvalidBlockSelection = vec![InvalidBlockHookType::Witness].into();
Implementations§
Source§impl InvalidBlockSelection
impl InvalidBlockSelection
Sourcepub fn try_from_selection<I, T>(selection: I) -> Result<Self, T::Error>
pub fn try_from_selection<I, T>(selection: I) -> Result<Self, T::Error>
Creates a new unique InvalidBlockSelection
from the given items.
§Note
This will dedupe the selection and remove duplicates while preserving the order.
§Example
Create a selection from the InvalidBlockHookType
string identifiers
use reth_node_core::args::{InvalidBlockHookType, InvalidBlockSelection};
let selection = vec!["witness", "prestate", "opcode"];
let config = InvalidBlockSelection::try_from_selection(selection).unwrap();
assert_eq!(
config,
InvalidBlockSelection::from([
InvalidBlockHookType::Witness,
InvalidBlockHookType::PreState,
InvalidBlockHookType::Opcode
])
);
Create a unique selection from the InvalidBlockHookType
string identifiers
use reth_node_core::args::{InvalidBlockHookType, InvalidBlockSelection};
let selection = vec!["witness", "prestate", "opcode", "witness", "prestate"];
let config = InvalidBlockSelection::try_from_selection(selection).unwrap();
assert_eq!(
config,
InvalidBlockSelection::from([
InvalidBlockHookType::Witness,
InvalidBlockHookType::PreState,
InvalidBlockHookType::Opcode
])
);
Sourcepub fn to_selection(&self) -> HashSet<InvalidBlockHookType>
pub fn to_selection(&self) -> HashSet<InvalidBlockHookType>
Clones the set of configured InvalidBlockHookType
.
Methods from Deref<Target = HashSet<InvalidBlockHookType>>§
1.0.0 · Sourcepub fn capacity(&self) -> usize
Available on crate feature map
only.
pub fn capacity(&self) -> usize
map
only.Returns the number of elements the set can hold without reallocating.
§Examples
use std::collections::HashSet;
let set: HashSet<i32> = HashSet::with_capacity(100);
assert!(set.capacity() >= 100);
1.0.0 · Sourcepub fn iter(&self) -> Iter<'_, T> ⓘ
Available on crate feature map
only.
pub fn iter(&self) -> Iter<'_, T> ⓘ
map
only.An iterator visiting all elements in arbitrary order.
The iterator element type is &'a T
.
§Examples
use std::collections::HashSet;
let mut set = HashSet::new();
set.insert("a");
set.insert("b");
// Will print in an arbitrary order.
for x in set.iter() {
println!("{x}");
}
§Performance
In the current implementation, iterating over set takes O(capacity) time instead of O(len) because it internally visits empty buckets too.
1.0.0 · Sourcepub fn len(&self) -> usize
Available on crate feature map
only.
pub fn len(&self) -> usize
map
only.Returns the number of elements in the set.
§Examples
use std::collections::HashSet;
let mut v = HashSet::new();
assert_eq!(v.len(), 0);
v.insert(1);
assert_eq!(v.len(), 1);
1.0.0 · Sourcepub fn is_empty(&self) -> bool
Available on crate feature map
only.
pub fn is_empty(&self) -> bool
map
only.Returns true
if the set contains no elements.
§Examples
use std::collections::HashSet;
let mut v = HashSet::new();
assert!(v.is_empty());
v.insert(1);
assert!(!v.is_empty());
1.9.0 · Sourcepub fn hasher(&self) -> &S
Available on crate feature map
only.
pub fn hasher(&self) -> &S
map
only.Returns a reference to the set’s BuildHasher
.
§Examples
use std::collections::HashSet;
use std::hash::RandomState;
let hasher = RandomState::new();
let set: HashSet<i32> = HashSet::with_hasher(hasher);
let hasher: &RandomState = set.hasher();
1.0.0 · Sourcepub fn difference<'a>(
&'a self,
other: &'a HashSet<T, S>,
) -> Difference<'a, T, S> ⓘ
Available on crate feature map
only.
pub fn difference<'a>( &'a self, other: &'a HashSet<T, S>, ) -> Difference<'a, T, S> ⓘ
map
only.Visits the values representing the difference,
i.e., the values that are in self
but not in other
.
§Examples
use std::collections::HashSet;
let a = HashSet::from([1, 2, 3]);
let b = HashSet::from([4, 2, 3, 4]);
// Can be seen as `a - b`.
for x in a.difference(&b) {
println!("{x}"); // Print 1
}
let diff: HashSet<_> = a.difference(&b).collect();
assert_eq!(diff, [1].iter().collect());
// Note that difference is not symmetric,
// and `b - a` means something else:
let diff: HashSet<_> = b.difference(&a).collect();
assert_eq!(diff, [4].iter().collect());
1.0.0 · Sourcepub fn symmetric_difference<'a>(
&'a self,
other: &'a HashSet<T, S>,
) -> SymmetricDifference<'a, T, S> ⓘ
Available on crate feature map
only.
pub fn symmetric_difference<'a>( &'a self, other: &'a HashSet<T, S>, ) -> SymmetricDifference<'a, T, S> ⓘ
map
only.Visits the values representing the symmetric difference,
i.e., the values that are in self
or in other
but not in both.
§Examples
use std::collections::HashSet;
let a = HashSet::from([1, 2, 3]);
let b = HashSet::from([4, 2, 3, 4]);
// Print 1, 4 in arbitrary order.
for x in a.symmetric_difference(&b) {
println!("{x}");
}
let diff1: HashSet<_> = a.symmetric_difference(&b).collect();
let diff2: HashSet<_> = b.symmetric_difference(&a).collect();
assert_eq!(diff1, diff2);
assert_eq!(diff1, [1, 4].iter().collect());
1.0.0 · Sourcepub fn intersection<'a>(
&'a self,
other: &'a HashSet<T, S>,
) -> Intersection<'a, T, S> ⓘ
Available on crate feature map
only.
pub fn intersection<'a>( &'a self, other: &'a HashSet<T, S>, ) -> Intersection<'a, T, S> ⓘ
map
only.Visits the values representing the intersection,
i.e., the values that are both in self
and other
.
When an equal element is present in self
and other
then the resulting Intersection
may yield references to
one or the other. This can be relevant if T
contains fields which
are not compared by its Eq
implementation, and may hold different
value between the two equal copies of T
in the two sets.
§Examples
use std::collections::HashSet;
let a = HashSet::from([1, 2, 3]);
let b = HashSet::from([4, 2, 3, 4]);
// Print 2, 3 in arbitrary order.
for x in a.intersection(&b) {
println!("{x}");
}
let intersection: HashSet<_> = a.intersection(&b).collect();
assert_eq!(intersection, [2, 3].iter().collect());
1.0.0 · Sourcepub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> ⓘ
Available on crate feature map
only.
pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> ⓘ
map
only.Visits the values representing the union,
i.e., all the values in self
or other
, without duplicates.
§Examples
use std::collections::HashSet;
let a = HashSet::from([1, 2, 3]);
let b = HashSet::from([4, 2, 3, 4]);
// Print 1, 2, 3, 4 in arbitrary order.
for x in a.union(&b) {
println!("{x}");
}
let union: HashSet<_> = a.union(&b).collect();
assert_eq!(union, [1, 2, 3, 4].iter().collect());
1.0.0 · Sourcepub fn contains<Q>(&self, value: &Q) -> bool
Available on crate feature map
only.
pub fn contains<Q>(&self, value: &Q) -> bool
map
only.Returns true
if the set contains a value.
The value may be any borrowed form of the set’s value type, but
Hash
and Eq
on the borrowed form must match those for
the value type.
§Examples
use std::collections::HashSet;
let set = HashSet::from([1, 2, 3]);
assert_eq!(set.contains(&1), true);
assert_eq!(set.contains(&4), false);
1.9.0 · Sourcepub fn get<Q>(&self, value: &Q) -> Option<&T>
Available on crate feature map
only.
pub fn get<Q>(&self, value: &Q) -> Option<&T>
map
only.Returns a reference to the value in the set, if any, that is equal to the given value.
The value may be any borrowed form of the set’s value type, but
Hash
and Eq
on the borrowed form must match those for
the value type.
§Examples
use std::collections::HashSet;
let set = HashSet::from([1, 2, 3]);
assert_eq!(set.get(&2), Some(&2));
assert_eq!(set.get(&4), None);
1.0.0 · Sourcepub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool
Available on crate feature map
only.
pub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool
map
only.Returns true
if self
has no elements in common with other
.
This is equivalent to checking for an empty intersection.
§Examples
use std::collections::HashSet;
let a = HashSet::from([1, 2, 3]);
let mut b = HashSet::new();
assert_eq!(a.is_disjoint(&b), true);
b.insert(4);
assert_eq!(a.is_disjoint(&b), true);
b.insert(1);
assert_eq!(a.is_disjoint(&b), false);
1.0.0 · Sourcepub fn is_subset(&self, other: &HashSet<T, S>) -> bool
Available on crate feature map
only.
pub fn is_subset(&self, other: &HashSet<T, S>) -> bool
map
only.Returns true
if the set is a subset of another,
i.e., other
contains at least all the values in self
.
§Examples
use std::collections::HashSet;
let sup = HashSet::from([1, 2, 3]);
let mut set = HashSet::new();
assert_eq!(set.is_subset(&sup), true);
set.insert(2);
assert_eq!(set.is_subset(&sup), true);
set.insert(4);
assert_eq!(set.is_subset(&sup), false);
1.0.0 · Sourcepub fn is_superset(&self, other: &HashSet<T, S>) -> bool
Available on crate feature map
only.
pub fn is_superset(&self, other: &HashSet<T, S>) -> bool
map
only.Returns true
if the set is a superset of another,
i.e., self
contains at least all the values in other
.
§Examples
use std::collections::HashSet;
let sub = HashSet::from([1, 2]);
let mut set = HashSet::new();
assert_eq!(set.is_superset(&sub), false);
set.insert(0);
set.insert(1);
assert_eq!(set.is_superset(&sub), false);
set.insert(2);
assert_eq!(set.is_superset(&sub), true);
Trait Implementations§
Source§impl Clone for InvalidBlockSelection
impl Clone for InvalidBlockSelection
Source§fn clone(&self) -> InvalidBlockSelection
fn clone(&self) -> InvalidBlockSelection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for InvalidBlockSelection
impl Debug for InvalidBlockSelection
Source§impl Default for InvalidBlockSelection
impl Default for InvalidBlockSelection
Source§impl Deref for InvalidBlockSelection
impl Deref for InvalidBlockSelection
Source§impl Display for InvalidBlockSelection
impl Display for InvalidBlockSelection
Source§impl From<&[InvalidBlockHookType]> for InvalidBlockSelection
impl From<&[InvalidBlockHookType]> for InvalidBlockSelection
Source§fn from(s: &[InvalidBlockHookType]) -> Self
fn from(s: &[InvalidBlockHookType]) -> Self
Source§impl<const N: usize> From<[InvalidBlockHookType; N]> for InvalidBlockSelection
impl<const N: usize> From<[InvalidBlockHookType; N]> for InvalidBlockSelection
Source§fn from(s: [InvalidBlockHookType; N]) -> Self
fn from(s: [InvalidBlockHookType; N]) -> Self
Source§impl From<Vec<InvalidBlockHookType>> for InvalidBlockSelection
impl From<Vec<InvalidBlockHookType>> for InvalidBlockSelection
Source§fn from(s: Vec<InvalidBlockHookType>) -> Self
fn from(s: Vec<InvalidBlockHookType>) -> Self
Source§impl FromIterator<InvalidBlockHookType> for InvalidBlockSelection
impl FromIterator<InvalidBlockHookType> for InvalidBlockSelection
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = InvalidBlockHookType>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = InvalidBlockHookType>,
Source§impl FromStr for InvalidBlockSelection
impl FromStr for InvalidBlockSelection
Source§impl PartialEq for InvalidBlockSelection
impl PartialEq for InvalidBlockSelection
impl Eq for InvalidBlockSelection
impl StructuralPartialEq for InvalidBlockSelection
Auto Trait Implementations§
impl Freeze for InvalidBlockSelection
impl RefUnwindSafe for InvalidBlockSelection
impl Send for InvalidBlockSelection
impl Sync for InvalidBlockSelection
impl Unpin for InvalidBlockSelection
impl UnwindSafe for InvalidBlockSelection
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<T> Conv for T
impl<T> Conv for T
§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.§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
§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
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> 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> ⓘ
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> ⓘ
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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
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: 48 bytes