pub struct Correctness {
    pub base: Base,
    pub input: Input,
    pub dissatisfiable: bool,
    pub unit: bool,
}
Expand description

Structure representing the type properties of a fragment which are relevant to completeness (are all expected branches actually accessible, given some valid witness) and soundness (is it possible to satisfy the Script without satisfying one of the Miniscript branches).

Fields§

§base: Base

The base type

§input: Input

Properties of the inputs

§dissatisfiable: bool

Whether it is definitely possible to dissatisfy the expression. If this is false, it does not necessarily mean that dissatisfaction is impossible (see Dissat::None for this property); it only means that we cannot depend on having a dissatisfaction when reasoning about completeness.

§unit: bool

Whether the fragment’s “nonzero” output on satisfaction is always the constant 1.

Implementations§

source§

impl Correctness

source

pub fn is_subtype(&self, other: Self) -> bool

Check whether the self is a subtype of other argument . This checks whether the argument other has attributes which are present in the given Type. This returns true on same arguments a.is_subtype(a) is true.

Trait Implementations§

source§

impl Clone for Correctness

source§

fn clone(&self) -> Correctness

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Correctness

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Correctness

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Correctness

source§

fn cmp(&self, other: &Correctness) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Correctness> for Correctness

source§

fn eq(&self, other: &Correctness) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Correctness> for Correctness

source§

fn partial_cmp(&self, other: &Correctness) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Property for Correctness

source§

fn sanity_checks(&self)

Any extra sanity checks/assertions that should be applied after typechecking
source§

fn from_true() -> Self

Type property of the True fragment
source§

fn from_false() -> Self

Type property of the False fragment
source§

fn from_pk_k<Ctx: ScriptContext>() -> Self

Type property of the PkK fragment
source§

fn from_pk_h<Ctx: ScriptContext>() -> Self

Type property of the PkH fragment
source§

fn from_multi(_: usize, _: usize) -> Self

Type property of a Multi fragment
source§

fn from_multi_a(_: usize, _: usize) -> Self

Type property of a MultiA fragment
source§

fn from_hash() -> Self

Type property of a hash fragment
source§

fn from_time(_: u32) -> Self

Type property of a timelock
source§

fn cast_alt(self) -> Result<Self, ErrorKind>

Cast using the Alt wrapper
source§

fn cast_swap(self) -> Result<Self, ErrorKind>

Cast using the Swap wrapper
source§

fn cast_check(self) -> Result<Self, ErrorKind>

Cast using the Check wrapper
source§

fn cast_dupif(self) -> Result<Self, ErrorKind>

Cast using the DupIf wrapper
source§

fn cast_verify(self) -> Result<Self, ErrorKind>

Cast using the Verify wrapper
source§

fn cast_nonzero(self) -> Result<Self, ErrorKind>

Cast using the NonZero wrapper
source§

fn cast_zeronotequal(self) -> Result<Self, ErrorKind>

Cast using the ZeroNotEqual wrapper
source§

fn cast_true(self) -> Result<Self, ErrorKind>

Cast by changing [X] to AndV([X], True)
source§

fn cast_or_i_false(self) -> Result<Self, ErrorKind>

Cast by changing [X] to or_i([X], 0) or or_i(0, [X])
source§

fn and_b(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an AndB fragment
source§

fn and_v(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an AndV fragment
source§

fn or_b(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an OrB fragment
source§

fn or_d(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an OrD fragment
source§

fn or_c(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an OrC fragment
source§

fn or_i(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an OrI fragment
source§

fn and_or(a: Self, b: Self, c: Self) -> Result<Self, ErrorKind>

Computes the type of an AndOr fragment
source§

fn threshold<S>(_k: usize, n: usize, sub_ck: S) -> Result<Self, ErrorKind>where S: FnMut(usize) -> Result<Self, ErrorKind>,

Computes the type of an Thresh fragment
source§

fn from_sha256() -> Self

Type property of a Sha256 hash. Default implementation simply passes through to from_hash
source§

fn from_hash256() -> Self

Type property of a Hash256 hash. Default implementation simply passes through to from_hash
source§

fn from_ripemd160() -> Self

Type property of a Ripemd160 hash. Default implementation simply passes through to from_hash
source§

fn from_hash160() -> Self

Type property of a Hash160 hash. Default implementation simply passes through to from_hash
source§

fn from_after(t: LockTime) -> Self

Type property of an absolute timelock. Default implementation simply passes through to from_time
source§

fn from_older(t: Sequence) -> Self

Type property of a relative timelock. Default implementation simply passes through to from_time
source§

fn cast_unlikely(self) -> Result<Self, ErrorKind>

Cast by changing [X] to or_i([X], 0). Default implementation simply passes through to cast_or_i_false
source§

fn cast_likely(self) -> Result<Self, ErrorKind>

Cast by changing [X] to or_i(0, [X]). Default implementation simply passes through to cast_or_i_false
source§

fn and_n(left: Self, right: Self) -> Result<Self, ErrorKind>

Computes the type of an AndN fragment
source§

fn type_check<Pk, Ctx, C>( fragment: &Terminal<Pk, Ctx>, child: C ) -> Result<Self, Error<Pk, Ctx>>where C: FnMut(usize) -> Option<Self>, Pk: MiniscriptKey, Ctx: ScriptContext,

Compute the type of a fragment, given a function to look up the types of its children, if available and relevant for the given fragment
source§

impl Copy for Correctness

source§

impl Eq for Correctness

source§

impl StructuralEq for Correctness

source§

impl StructuralPartialEq for Correctness

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V