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
sourceimpl Correctness
impl Correctness
sourcepub fn is_subtype(&self, other: Self) -> bool
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
sourceimpl Clone for Correctness
impl Clone for Correctness
sourcefn clone(&self) -> Correctness
fn clone(&self) -> Correctness
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Correctness
impl Debug for Correctness
sourceimpl Hash for Correctness
impl Hash for Correctness
sourceimpl Ord for Correctness
impl Ord for Correctness
sourceimpl PartialEq<Correctness> for Correctness
impl PartialEq<Correctness> for Correctness
sourcefn eq(&self, other: &Correctness) -> bool
fn eq(&self, other: &Correctness) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Correctness) -> bool
fn ne(&self, other: &Correctness) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Correctness> for Correctness
impl PartialOrd<Correctness> for Correctness
sourcefn partial_cmp(&self, other: &Correctness) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
sourceimpl Property for Correctness
impl Property for Correctness
sourcefn sanity_checks(&self)
fn sanity_checks(&self)
Any extra sanity checks/assertions that should be applied after typechecking Read more
sourcefn from_false() -> Self
fn from_false() -> Self
Type property of the False
fragment
sourcefn from_multi(_: usize, _: usize) -> Self
fn from_multi(_: usize, _: usize) -> Self
Type property of a Multi
fragment
sourcefn cast_check(self) -> Result<Self, ErrorKind>
fn cast_check(self) -> Result<Self, ErrorKind>
Cast using the Check
wrapper
sourcefn cast_dupif(self) -> Result<Self, ErrorKind>
fn cast_dupif(self) -> Result<Self, ErrorKind>
Cast using the DupIf
wrapper
sourcefn cast_verify(self) -> Result<Self, ErrorKind>
fn cast_verify(self) -> Result<Self, ErrorKind>
Cast using the Verify
wrapper
sourcefn cast_nonzero(self) -> Result<Self, ErrorKind>
fn cast_nonzero(self) -> Result<Self, ErrorKind>
Cast using the NonZero
wrapper
sourcefn cast_zeronotequal(self) -> Result<Self, ErrorKind>
fn cast_zeronotequal(self) -> Result<Self, ErrorKind>
Cast using the ZeroNotEqual
wrapper
sourcefn cast_or_i_false(self) -> Result<Self, ErrorKind>
fn cast_or_i_false(self) -> Result<Self, ErrorKind>
Cast by changing [X]
to or_i([X], 0)
or or_i(0, [X])
sourcefn and_b(left: Self, right: Self) -> Result<Self, ErrorKind>
fn and_b(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an AndB
fragment
sourcefn and_v(left: Self, right: Self) -> Result<Self, ErrorKind>
fn and_v(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an AndV
fragment
sourcefn or_b(left: Self, right: Self) -> Result<Self, ErrorKind>
fn or_b(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an OrB
fragment
sourcefn or_d(left: Self, right: Self) -> Result<Self, ErrorKind>
fn or_d(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an OrD
fragment
sourcefn or_c(left: Self, right: Self) -> Result<Self, ErrorKind>
fn or_c(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an OrC
fragment
sourcefn or_i(left: Self, right: Self) -> Result<Self, ErrorKind>
fn or_i(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an OrI
fragment
sourcefn and_or(a: Self, b: Self, c: Self) -> Result<Self, ErrorKind>
fn and_or(a: Self, b: Self, c: Self) -> Result<Self, ErrorKind>
Computes the type of an AndOr
fragment
sourcefn threshold<S>(k: usize, n: usize, sub_ck: S) -> Result<Self, ErrorKind> where
S: FnMut(usize) -> Result<Self, ErrorKind>,
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
sourcefn from_sha256() -> Self
fn from_sha256() -> Self
Type property of a Sha256
hash. Default implementation simply
passes through to from_hash
Read more
sourcefn from_hash256() -> Self
fn from_hash256() -> Self
Type property of a Hash256
hash. Default implementation simply
passes through to from_hash
Read more
sourcefn from_ripemd160() -> Self
fn from_ripemd160() -> Self
Type property of a Ripemd160
hash. Default implementation simply
passes through to from_hash
Read more
sourcefn from_hash160() -> Self
fn from_hash160() -> Self
Type property of a Hash160
hash. Default implementation simply
passes through to from_hash
Read more
sourcefn from_after(t: u32) -> Self
fn from_after(t: u32) -> Self
Type property of a relative timelock. Default implementation simply
passes through to from_time
Read more
sourcefn from_older(t: u32) -> Self
fn from_older(t: u32) -> Self
Type property of an absolute timelock. Default implementation simply
passes through to from_time
Read more
sourcefn cast_unlikely(self) -> Result<Self, ErrorKind>
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
Read more
sourcefn cast_likely(self) -> Result<Self, ErrorKind>
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
Read more
sourcefn and_n(left: Self, right: Self) -> Result<Self, ErrorKind>
fn and_n(left: Self, right: Self) -> Result<Self, ErrorKind>
Computes the type of an AndN
fragment
sourcefn 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,
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 Read more
impl Copy for Correctness
impl Eq for Correctness
impl StructuralEq for Correctness
impl StructuralPartialEq for Correctness
Auto Trait Implementations
impl RefUnwindSafe for Correctness
impl Send for Correctness
impl Sync for Correctness
impl Unpin for Correctness
impl UnwindSafe for Correctness
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more