Struct psbt::PsbtSighashType
source · [−]pub struct PsbtSighashType { /* private fields */ }
Expand description
A Signature hash type for the corresponding input. As of taproot upgrade, the signature hash
type can be either EcdsaSighashType
or SchnorrSighashType
but it is not possible to know
directly which signature hash type the user is dealing with. Therefore, the user is responsible
for converting to/from PsbtSighashType
from/to the desired signature hash type they need.
Implementations
sourceimpl PsbtSighashType
impl PsbtSighashType
sourcepub fn ecdsa_hash_ty(self) -> Result<EcdsaSighashType, NonStandardSighashType>
pub fn ecdsa_hash_ty(self) -> Result<EcdsaSighashType, NonStandardSighashType>
Returns the EcdsaSighashType
if the PsbtSighashType
can be
converted to one.
sourcepub fn schnorr_hash_ty(self) -> Result<SchnorrSighashType, Error>
pub fn schnorr_hash_ty(self) -> Result<SchnorrSighashType, Error>
Returns the SchnorrSighashType
if the PsbtSighashType
can be
converted to one.
sourcepub fn from_u32(n: u32) -> PsbtSighashType
pub fn from_u32(n: u32) -> PsbtSighashType
Creates a PsbtSighashType
from a raw u32
.
Allows construction of a non-standard or non-valid sighash flag
(EcdsaSighashType
, SchnorrSighashType
respectively).
sourcepub fn to_u32(self) -> u32
pub fn to_u32(self) -> u32
Converts PsbtSighashType
to a raw u32
sighash flag.
No guarantees are made as to the standardness or validity of the returned value.
Trait Implementations
sourceimpl Clone for PsbtSighashType
impl Clone for PsbtSighashType
sourcefn clone(&self) -> PsbtSighashType
fn clone(&self) -> PsbtSighashType
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 PsbtSighashType
impl Debug for PsbtSighashType
sourceimpl Deserialize for PsbtSighashType
impl Deserialize for PsbtSighashType
sourcefn deserialize(bytes: &[u8]) -> Result<PsbtSighashType, Error>
fn deserialize(bytes: &[u8]) -> Result<PsbtSighashType, Error>
Deserialize a value from raw data.
sourceimpl Display for PsbtSighashType
impl Display for PsbtSighashType
sourceimpl From<EcdsaSighashType> for PsbtSighashType
impl From<EcdsaSighashType> for PsbtSighashType
sourcefn from(ecdsa_hash_ty: EcdsaSighashType) -> PsbtSighashType
fn from(ecdsa_hash_ty: EcdsaSighashType) -> PsbtSighashType
Converts to this type from the input type.
sourceimpl From<SchnorrSighashType> for PsbtSighashType
impl From<SchnorrSighashType> for PsbtSighashType
sourcefn from(schnorr_hash_ty: SchnorrSighashType) -> PsbtSighashType
fn from(schnorr_hash_ty: SchnorrSighashType) -> PsbtSighashType
Converts to this type from the input type.
sourceimpl FromStr for PsbtSighashType
impl FromStr for PsbtSighashType
type Err = SighashTypeParseError
type Err = SighashTypeParseError
The associated error which can be returned from parsing.
sourcefn from_str(
s: &str
) -> Result<PsbtSighashType, <PsbtSighashType as FromStr>::Err>
fn from_str(
s: &str
) -> Result<PsbtSighashType, <PsbtSighashType as FromStr>::Err>
Parses a string s
to return a value of this type. Read more
sourceimpl Hash for PsbtSighashType
impl Hash for PsbtSighashType
sourceimpl Ord for PsbtSighashType
impl Ord for PsbtSighashType
sourcefn cmp(&self, other: &PsbtSighashType) -> Ordering
fn cmp(&self, other: &PsbtSighashType) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<PsbtSighashType> for PsbtSighashType
impl PartialEq<PsbtSighashType> for PsbtSighashType
sourcefn eq(&self, other: &PsbtSighashType) -> bool
fn eq(&self, other: &PsbtSighashType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PsbtSighashType) -> bool
fn ne(&self, other: &PsbtSighashType) -> bool
This method tests for !=
.
sourceimpl PartialOrd<PsbtSighashType> for PsbtSighashType
impl PartialOrd<PsbtSighashType> for PsbtSighashType
sourcefn partial_cmp(&self, other: &PsbtSighashType) -> Option<Ordering>
fn partial_cmp(&self, other: &PsbtSighashType) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for PsbtSighashType
impl Serialize for PsbtSighashType
sourceimpl StrictDecode for PsbtSighashType
impl StrictDecode for PsbtSighashType
sourcefn strict_decode<D>(d: D) -> Result<PsbtSighashType, Error> where
D: Read,
fn strict_decode<D>(d: D) -> Result<PsbtSighashType, Error> where
D: Read,
Decode with the given std::io::Read
instance; must either
construct an instance or return implementation-specific error type. Read more
sourcefn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode
. If there are some data remains in the
buffer once deserialization is completed, fails with
Error::DataNotEntirelyConsumed
. Use io::Cursor
over the buffer and
StrictDecode::strict_decode
to avoid such failures. Read more
sourcefn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
Reads data from file at path
and reconstructs object from it. Fails
with Error::DataNotEntirelyConsumed
if file contains remaining
data after the object reconstruction. Read more
sourceimpl StrictEncode for PsbtSighashType
impl StrictEncode for PsbtSighashType
sourcefn strict_encode<E>(&self, e: E) -> Result<usize, Error> where
E: Write,
fn strict_encode<E>(&self, e: E) -> Result<usize, Error> where
E: Write,
Encode with the given std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type. Read more
sourcefn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using StrictEncode::strict_encode
function Read more
impl Copy for PsbtSighashType
impl Eq for PsbtSighashType
impl StructuralEq for PsbtSighashType
impl StructuralPartialEq for PsbtSighashType
Auto Trait Implementations
impl RefUnwindSafe for PsbtSighashType
impl Send for PsbtSighashType
impl Sync for PsbtSighashType
impl Unpin for PsbtSighashType
impl UnwindSafe for PsbtSighashType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more