[][src]Trait miniscript::TranslatePk

pub trait TranslatePk<P: MiniscriptKey, Q: MiniscriptKey> {
    type Output;
    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>
; fn translate_pk_infallible<Fpk, Fpkh>(
        &self,
        mut translatefpk: Fpk,
        mut translatefpkh: Fpkh
    ) -> Self::Output
    where
        Fpk: FnMut(&P) -> Q,
        Fpkh: FnMut(&P::Hash) -> Q::Hash
, { ... } }

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.

Associated Types

type Output[src]

The associated output type. This must be Self

Loading content...

Required methods

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>, 
[src]

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

Loading content...

Provided methods

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

Calls translate_pk with conversion functions that cannot fail

Loading content...

Implementors

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Descriptor<P>[src]

type Output = Descriptor<Q>

fn translate_pk<Fpk, Fpkh, E>(
    &self,
    mut translatefpk: Fpk,
    mut translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
    Fpk: FnMut(&P) -> Result<Q, E>,
    Fpkh: FnMut(&P::Hash) -> Result<Q::Hash, E>,
    Q: MiniscriptKey
[src]

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.

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Bare<P>[src]

type Output = Bare<Q>

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Pkh<P>[src]

type Output = Pkh<Q>

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Sh<P>[src]

type Output = Sh<Q>

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Wpkh<P>[src]

type Output = Wpkh<Q>

impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Wsh<P>[src]

type Output = Wsh<Q>

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

type Output = Terminal<Q, Ctx>

fn translate_pk<FPk, FPkh, FuncError>(
    &self,
    mut translatefpk: FPk,
    mut translatefpkh: FPkh
) -> Result<Self::Output, FuncError> where
    FPk: FnMut(&Pk) -> Result<Q, FuncError>,
    FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, FuncError>, 
[src]

Convert an AST element with one public key type to one of another public key type .This will panic while converting to Segwit Miniscript using uncompressed public keys

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

type Output = Miniscript<Q, Ctx>

fn translate_pk<FPk, FPkh, FuncError>(
    &self,
    mut translatefpk: FPk,
    mut translatefpkh: FPkh
) -> Result<Self::Output, FuncError> where
    FPk: FnMut(&Pk) -> Result<Q, FuncError>,
    FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, FuncError>, 
[src]

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.

Loading content...