Struct miniscript::miniscript::types::correctness::Correctness

source ·
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 const TRUE: Self = _

Correctness data for the 1 combinator

source

pub const FALSE: Self = _

Correctness data for the 0 combinator

source

pub const 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.

source

pub fn sanity_checks(&self)

Confirm invariants of the correctness checker.

source

pub const fn pk_k() -> Self

Constructor for the correctness properties of the pk_k fragment.

source

pub const fn pk_h() -> Self

Constructor for the correctness properties of the pk_h fragment.

source

pub const fn multi() -> Self

Constructor for the correctness properties of the multi fragment.

source

pub const fn multi_a() -> Self

Constructor for the correctness properties of the multi_a fragment.

source

pub const fn hash() -> Self

Constructor for the correctness properties of any of the hash fragments.

source

pub const fn time() -> Self

Constructor for the correctness properties of either of the time fragments.

source

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

Constructor for the correctness properties of the a: fragment.

source

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

Constructor for the correctness properties of the s: fragment.

source

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

Constructor for the correctness properties of the c: fragment.

source

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

Constructor for the correctness properties of the d: fragment.

source

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

Constructor for the correctness properties of the v: fragment.

source

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

Constructor for the correctness properties of the j: fragment.

source

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

Constructor for the correctness properties of the n: fragment.

source

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

Constructor for the correctness properties of the t: fragment.

source

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

Constructor for the correctness properties of the l: and u: fragments.

source

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

Constructor for the correctness properties of the and_b fragment

source

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

Constructor for the correctness properties of the and_v fragment

source

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

Constructor for the correctness properties of the or_b fragment

source

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

Constructor for the correctness properties of the or_d fragment

source

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

Constructor for the correctness properties of the or_c fragment

source

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

Constructor for the correctness properties of the or_i fragment

source

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

Constructor for the correctness properties of the andor fragment

source

pub fn threshold<'a, I>(_k: usize, subs: I) -> Result<Self, ErrorKind>
where I: Iterator<Item = &'a Self>,

Constructor for the correctness properties of the thresh fragment

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) -> Self
where Self: Sized,

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

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

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

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

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

impl PartialEq 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 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 Copy for Correctness

source§

impl Eq for Correctness

source§

impl StructuralPartialEq for Correctness

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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 T
where 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.
source§

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

source§

fn vzip(self) -> V