Struct Signature
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§
§impl Signature
impl Signature
pub fn from_slice(sl: &[u8]) -> Result<Signature, SigFromSliceError>
pub fn from_slice(sl: &[u8]) -> Result<Signature, SigFromSliceError>
Deserialize from slice
pub 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.
pub fn serialize_to_writer<W>(&self, writer: &mut W) -> Result<(), Error>
pub fn serialize_to_writer<W>(&self, writer: &mut W) -> Result<(), Error>
Serializes the signature to writer
.
pub 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§
§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Signature, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Signature, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<'a> From<&'a Signature> for SerializedSignature
impl<'a> From<&'a Signature> for SerializedSignature
§fn from(value: &'a Signature) -> SerializedSignature
fn from(value: &'a Signature) -> SerializedSignature
Converts to this type from the input type.
§impl From<Signature> for SerializedSignature
impl From<Signature> for SerializedSignature
§fn from(value: Signature) -> SerializedSignature
fn from(value: Signature) -> SerializedSignature
Converts to this type from the input type.
§impl Ord for Signature
impl Ord for Signature
§impl PartialOrd for Signature
impl PartialOrd for Signature
§impl Serialize for Signature
impl Serialize for Signature
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§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.
§fn try_from(
value: &'a SerializedSignature,
) -> Result<Signature, <Signature as TryFrom<&'a SerializedSignature>>::Error>
fn try_from( value: &'a SerializedSignature, ) -> Result<Signature, <Signature as TryFrom<&'a SerializedSignature>>::Error>
Performs the conversion.
§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.
§fn try_from(
value: SerializedSignature,
) -> Result<Signature, <Signature as TryFrom<SerializedSignature>>::Error>
fn try_from( value: SerializedSignature, ) -> Result<Signature, <Signature as TryFrom<SerializedSignature>>::Error>
Performs the conversion.
impl Copy for Signature
impl Eq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl Freeze for Signature
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more