pub enum Parity {
Eip155(u64),
NonEip155(bool),
Parity(bool),
}
Expand description
The parity of the signature, stored as either a V value (which may include a chain id), or the y-parity.
Variants§
Eip155(u64)
Explicit V value. May be EIP-155 modified.
NonEip155(bool)
Non-EIP155. 27 or 28.
Parity(bool)
Parity flag. True for odd.
Implementations§
Source§impl Parity
impl Parity
Sourcepub const fn chain_id(&self) -> Option<ChainId>
pub const fn chain_id(&self) -> Option<ChainId>
Returns the chain ID associated with the V value, if this signature is replay-protected by EIP-155.
Sourcepub const fn has_eip155_value(&self) -> bool
pub const fn has_eip155_value(&self) -> bool
Returns true if the signature is replay-protected by EIP-155.
This is true if the V value is 35 or greater. Values less than 35 are either not replay protected (27/28), or are invalid.
Sourcepub const fn y_parity_byte(&self) -> u8
pub const fn y_parity_byte(&self) -> u8
Return the y-parity as 0 or 1
Sourcepub const fn y_parity_byte_non_eip155(&self) -> Option<u8>
pub const fn y_parity_byte_non_eip155(&self) -> Option<u8>
Return the y-parity byte as 27 or 28, in the case of a non-EIP155 signature.
Sourcepub const fn strip_chain_id(&self) -> Self
pub const fn strip_chain_id(&self) -> Self
Converts an EIP-155 V value to a non-EIP-155 V value.
This is a nop for non-EIP-155 values.
Sourcepub const fn with_chain_id(self, chain_id: ChainId) -> Self
pub const fn with_chain_id(self, chain_id: ChainId) -> Self
Applies EIP-155 with the given chain ID.
Sourcepub const fn recid(&self) -> RecoveryId
Available on crate feature k256
only.
pub const fn recid(&self) -> RecoveryId
k256
only.Determines the recovery ID.
Sourcepub const fn to_parity_bool(self) -> Self
pub const fn to_parity_bool(self) -> Self
Convert to a parity bool, dropping any V information.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Parity
impl<'arbitrary> Arbitrary<'arbitrary> for Parity
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§impl Arbitrary for Parity
impl Arbitrary for Parity
Source§type Parameters = (<u64 as Arbitrary>::Parameters, <bool as Arbitrary>::Parameters, <bool as Arbitrary>::Parameters)
type Parameters = (<u64 as Arbitrary>::Parameters, <bool as Arbitrary>::Parameters, <bool as Arbitrary>::Parameters)
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.Source§type Strategy = TupleUnion<((u32, Arc<Map<<u64 as Arbitrary>::Strategy, fn(_: u64) -> Parity>>), (u32, Arc<Map<<bool as Arbitrary>::Strategy, fn(_: bool) -> Parity>>), (u32, Arc<Map<<bool as Arbitrary>::Strategy, fn(_: bool) -> Parity>>))>
type Strategy = TupleUnion<((u32, Arc<Map<<u64 as Arbitrary>::Strategy, fn(_: u64) -> Parity>>), (u32, Arc<Map<<bool as Arbitrary>::Strategy, fn(_: bool) -> Parity>>), (u32, Arc<Map<<bool as Arbitrary>::Strategy, fn(_: bool) -> Parity>>))>
Strategy
used to generate values of type Self
.Source§fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
Source§impl From<RecoveryId> for Parity
Available on crate feature k256
only.
impl From<RecoveryId> for Parity
k256
only.Source§fn from(value: RecoveryId) -> Self
fn from(value: RecoveryId) -> Self
impl Copy for Parity
impl Eq for Parity
impl StructuralPartialEq for Parity
Auto Trait Implementations§
impl Freeze for Parity
impl RefUnwindSafe for Parity
impl Send for Parity
impl Sync for Parity
impl Unpin for Parity
impl UnwindSafe for Parity
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.