Trait ParseableExt

Source
pub trait ParseableExt:
    Extension
    + Clone
    + Eq
    + Ord
    + Debug
    + Display
    + Hash {
    // Required methods
    fn from_token_iter(
        _tokens: &mut TokenIter<'_>,
    ) -> Result<Self, FromTokenIterError>;
    fn evaluate(
        &self,
        stack: &mut Stack<'_>,
        txenv: Option<&TxEnv<'_, '_>>,
    ) -> Result<bool, Error>;
    fn push_to_builder(&self, builder: Builder) -> Builder;
    fn satisfy<Pk, S>(&self, _sat: &S) -> Satisfaction
       where Pk: ToPublicKey,
             S: Satisfier<Pk>;
    fn dissatisfy<Pk, S>(&self, _sat: &S) -> Satisfaction
       where Pk: ToPublicKey,
             S: Satisfier<Pk>;
}
Expand description

Support for parsing/serializing/satisfaction of extensions. Extension trait reasons about extension in abstract way whereas this trait reasons about the concrete data structures. Extension is similar to MiniscriptKey, whereas ParseableExt is similar to ToPublicKey.

Required Methods§

Source

fn from_token_iter( _tokens: &mut TokenIter<'_>, ) -> Result<Self, FromTokenIterError>

Parse the terminal from TokenIter. Implementers of this trait are responsible for making sure tokens is mutated correctly. If parsing is not successful, the tokens should not be consumed.

Source

fn evaluate( &self, stack: &mut Stack<'_>, txenv: Option<&TxEnv<'_, '_>>, ) -> Result<bool, Error>

Interpreter support Evaluate the fragment based on inputs from stack. If an implementation of this is provided the user can use the interpreter API to parse scripts from blockchain and check which constraints are satisfied Output Ok(true) when the ext fragment is satisfied. Output Ok(false) when the ext fragment is dissatisfied, Output Some(Err) when there is an error in interpreter value.

Source

fn push_to_builder(&self, builder: Builder) -> Builder

Encoding of the current fragment

Source

fn satisfy<Pk, S>(&self, _sat: &S) -> Satisfaction
where Pk: ToPublicKey, S: Satisfier<Pk>,

Produce a satisfaction for this from satisfier. See satisfaction code in satisfy.rs for example Note that the Satisfaction struct also covers the case when satisfaction is impossible/unavailable

Source

fn dissatisfy<Pk, S>(&self, _sat: &S) -> Satisfaction
where Pk: ToPublicKey, S: Satisfier<Pk>,

Produce a satisfaction for this from satisfier. See satisfaction code in satisfy.rs for example Note that the Satisfaction struct also covers the case when dissatisfaction is impossible/unavailable

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.

Implementors§