#[repr(u8)]pub enum Parity {
Even = 0,
Odd = 1,
}
Expand description
Represents the parity passed between FFI function calls.
Variants§
Implementations§
Source§impl Parity
impl Parity
Sourcepub fn to_consensus_u8(self) -> u8
pub fn to_consensus_u8(self) -> u8
Converts parity into an integer (byte) value.
This returns 0
for even parity and 1
for odd parity.
Sourcepub fn from_consensus_u8(parity: u8) -> Result<Parity, InvalidParityValue>
pub fn from_consensus_u8(parity: u8) -> Result<Parity, InvalidParityValue>
Constructs a Parity
from a byte.
The only allowed values are 0
meaning even parity and 1
meaning odd.
Other values result in error being returned.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Parity
impl<'de> Deserialize<'de> for Parity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Parity
impl Ord for Parity
Source§impl PartialOrd for Parity
impl PartialOrd for Parity
Source§impl StrictDecode for Parity
impl StrictDecode for Parity
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for Parity
impl StrictDumb for Parity
fn strict_dumb() -> Self
Source§impl StrictEncode for Parity
impl StrictEncode for Parity
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictEnum for Parity
impl StrictEnum for Parity
fn from_variant_name( name: &VariantName, ) -> Result<Self, VariantError<&VariantName>>
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictSum for Parity
impl StrictSum for Parity
const ALL_VARIANTS: &'static [(u8, &'static str)]
fn variant_name(&self) -> &'static str
fn strict_check_variants()
fn variant_name_by_tag(tag: u8) -> Option<VariantName>
fn variant_ord(&self) -> u8
Source§impl StrictType for Parity
impl StrictType for Parity
const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN
fn strict_name() -> Option<TypeName>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
Compare self to
key
and return true
if they are equal.