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§

source

type Output

The associated output type. This must be Self

Required Methods§

source

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>,

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§

source

fn translate_pk_infallible<Fpk, Fpkh>( &self, translatefpk: Fpk, translatefpkh: Fpkh ) -> Self::Output
where Fpk: FnMut(&P) -> Q, Fpkh: FnMut(&P::Hash) -> Q::Hash,

Calls translate_pk with conversion functions that cannot fail

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Descriptor<P>

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Bare<P>

§

type Output = Bare<Q>

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Pkh<P>

§

type Output = Pkh<Q>

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Sh<P>

§

type Output = Sh<Q>

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Tr<P>

§

type Output = Tr<Q>

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Wpkh<P>

§

type Output = Wpkh<Q>

source§

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Wsh<P>

§

type Output = Wsh<Q>

source§

impl<Pk: MiniscriptKey, Q: MiniscriptKey, Ctx: ScriptContext> TranslatePk<Pk, Q> for Terminal<Pk, Ctx>

§

type Output = Terminal<Q, Ctx>

source§

impl<Pk: MiniscriptKey, Q: MiniscriptKey, Ctx: ScriptContext> TranslatePk<Pk, Q> for Miniscript<Pk, Ctx>

§

type Output = Miniscript<Q, Ctx>