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ยง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.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 moreSourceยงimpl<T> Pointable for T
impl<T> Pointable 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: 16 bytes
Size for each variant:
Eip155
: 15 bytesNonEip155
: 1 byteParity
: 1 byte