pub struct Signature {
pub signature: Signature,
pub sighash_type: TapSighashType,
}
Expand description
A BIP340-341 serialized taproot signature with the corresponding hash type.
Fields§
§signature: Signature
The underlying schnorr signature.
sighash_type: TapSighashType
The corresponding hash type.
Implementations§
source§impl Signature
impl Signature
sourcepub fn from_slice(sl: &[u8]) -> Result<Self, SigFromSliceError>
pub fn from_slice(sl: &[u8]) -> Result<Self, SigFromSliceError>
Deserialize from slice
sourcepub fn to_vec(self) -> Vec<u8> ⓘ
pub fn to_vec(self) -> Vec<u8> ⓘ
Serialize Signature
Note: this allocates on the heap, prefer serialize
if vec is not needed.
sourcepub fn serialize_to_writer<W: Write + ?Sized>(
&self,
writer: &mut W
) -> Result<(), Error>
pub fn serialize_to_writer<W: Write + ?Sized>( &self, writer: &mut W ) -> Result<(), Error>
Serializes the signature to writer
.
sourcepub fn serialize(self) -> SerializedSignature
pub fn serialize(self) -> SerializedSignature
Serializes the signature (without heap allocation)
This returns a type with an API very similar to that of Box<[u8]>
.
You can get a slice from it using deref coercions or turn it into an iterator.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
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<'a> From<&'a Signature> for SerializedSignature
impl<'a> From<&'a Signature> for SerializedSignature
source§impl From<Signature> for SerializedSignature
impl From<Signature> for SerializedSignature
source§impl Ord for Signature
impl Ord for Signature
source§impl PartialEq<Signature> for Signature
impl PartialEq<Signature> for Signature
source§impl PartialOrd<Signature> for Signature
impl PartialOrd<Signature> for Signature
1.0.0 · source§fn 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 moresource§impl<'a> TryFrom<&'a SerializedSignature> for Signature
impl<'a> TryFrom<&'a SerializedSignature> for Signature
§type Error = SigFromSliceError
type Error = SigFromSliceError
The type returned in the event of a conversion error.
source§impl TryFrom<SerializedSignature> for Signature
impl TryFrom<SerializedSignature> for Signature
§type Error = SigFromSliceError
type Error = SigFromSliceError
The type returned in the event of a conversion error.
impl Copy for Signature
impl Eq for Signature
impl StructuralEq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
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