Trait sapio_miniscript::TranslatePk
source · pub trait TranslatePk<P: MiniscriptKey, Q: MiniscriptKey> {
type Output;
// Required method
fn translate_pk<Fpk, Fpkh, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Self::Output, E>
where Fpk: FnMut(&P) -> Result<Q, E>,
Fpkh: FnMut(&P::Hash) -> Result<Q::Hash, E>;
// Provided method
fn translate_pk_infallible<Fpk, Fpkh>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Self::Output
where Fpk: FnMut(&P) -> Q,
Fpkh: FnMut(&P::Hash) -> Q::Hash { ... }
}
Expand description
Convert a descriptor using abstract keys to one using specific keys This will panic if translatefpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure translatefpk returns an error in this case instead.
Required Associated Types§
Required Methods§
sourcefn translate_pk<Fpk, Fpkh, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Self::Output, E>
fn translate_pk<Fpk, Fpkh, E>( &self, translatefpk: Fpk, translatefpkh: Fpkh ) -> Result<Self::Output, E>
Translate a struct from one Generic to another where the translation for Pk is provided by translatefpk, and translation for PkH is provided by translatefpkh
Provided Methods§
Object Safety§
This trait is not object safe.