pub trait ToPublicKey: MiniscriptKey {
// Required methods
fn to_public_key(&self) -> PublicKey;
fn to_sha256(hash: &<Self as MiniscriptKey>::Sha256) -> Hash;
fn to_hash256(hash: &<Self as MiniscriptKey>::Hash256) -> Hash;
fn to_ripemd160(hash: &<Self as MiniscriptKey>::Ripemd160) -> Hash;
fn to_hash160(hash: &<Self as MiniscriptKey>::Hash160) -> Hash;
// Provided methods
fn to_x_only_pubkey(&self) -> XOnlyPublicKey { ... }
fn to_pubkeyhash(&self, sig_type: SigType) -> Hash { ... }
}
Expand description
Trait describing public key types which can be converted to bitcoin pubkeys
Required Methods§
Sourcefn to_public_key(&self) -> PublicKey
fn to_public_key(&self) -> PublicKey
Converts an object to a public key
Sourcefn to_sha256(hash: &<Self as MiniscriptKey>::Sha256) -> Hash
fn to_sha256(hash: &<Self as MiniscriptKey>::Sha256) -> Hash
Converts the generic associated MiniscriptKey::Sha256
to sha256::Hash
Sourcefn to_hash256(hash: &<Self as MiniscriptKey>::Hash256) -> Hash
fn to_hash256(hash: &<Self as MiniscriptKey>::Hash256) -> Hash
Converts the generic associated MiniscriptKey::Hash256
to hash256::Hash
Sourcefn to_ripemd160(hash: &<Self as MiniscriptKey>::Ripemd160) -> Hash
fn to_ripemd160(hash: &<Self as MiniscriptKey>::Ripemd160) -> Hash
Converts the generic associated MiniscriptKey::Ripemd160
to ripemd160::Hash
Sourcefn to_hash160(hash: &<Self as MiniscriptKey>::Hash160) -> Hash
fn to_hash160(hash: &<Self as MiniscriptKey>::Hash160) -> Hash
Converts the generic associated MiniscriptKey::Hash160
to hash160::Hash
Provided Methods§
Sourcefn to_x_only_pubkey(&self) -> XOnlyPublicKey
fn to_x_only_pubkey(&self) -> XOnlyPublicKey
Convert an object to x-only pubkey
Sourcefn to_pubkeyhash(&self, sig_type: SigType) -> Hash
fn to_pubkeyhash(&self, sig_type: SigType) -> Hash
Obtain the public key hash for this MiniscriptKey Expects an argument to specify the signature type. This would determine whether to serialize the key as 32 byte x-only pubkey or regular public key when computing the hash160
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.