pub struct Type {
    pub corr: Correctness,
    pub mall: Malleability,
}
Expand description

Structure representing the type of a Miniscript fragment, including all properties relevant to the main codebase

Fields§

§corr: Correctness

Correctness/soundness properties

§mall: Malleability

Malleability properties

Implementations§

source§

impl Type

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 Type

source§

fn clone(&self) -> Type

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 Type

source§

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

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

impl Hash for Type

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 Type

source§

fn cmp(&self, other: &Type) -> 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 Type

source§

fn eq(&self, other: &Type) -> 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 Type

source§

fn partial_cmp(&self, other: &Type) -> 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 Type

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 assuming all the children of Miniscript have been computed already.

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() -> Self

Type property of the PkK fragment
source§

fn from_pk_h() -> Self

Type property of the PkH fragment
source§

fn from_multi(k: usize, n: usize) -> Self

Type property of a Multi fragment
source§

fn from_hash() -> Self

Type property of a hash fragment
source§

fn from_sha256() -> Self

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

fn from_txtemplate() -> Self

Type property of a TxTemplate hash. Default implementation simply passes through to from_txtemplate
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_time(t: u32) -> Self

Type property of a timelock
source§

fn from_after(t: u32) -> Self

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

fn from_older(t: u32) -> Self

Type property of an absolute timelock. Default implementation simply passes through to from_time
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 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_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_multi_a(k: usize, n: usize) -> Self

Type property of a MultiA fragment
source§

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

Computes the type of an AndN fragment
source§

impl Copy for Type

source§

impl Eq for Type

source§

impl StructuralEq for Type

source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

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.