[−][src]Enum miniscript::policy::AbstractPolicy
An "abstract" script policy that does not distinguish between functionally
equivalent things. Designed to be filterable and analyzable, and to be
created from either concrete Policy
s or even-concreter Miniscript
s.
Variants
Key(P)
A public key which must sign to satisfy the descriptor
Hash(Hash)
A SHA256 whose preimage must be provided to satisfy the descriptor
Time(u32)
A locktime restriction
Threshold(usize, Vec<AbstractPolicy<P>>)
A set of descriptors, satisfactions must be provided for k
of them
And(Box<AbstractPolicy<P>>, Box<AbstractPolicy<P>>)
A list of descriptors, all of which must be satisfied
Or(Box<AbstractPolicy<P>>, Box<AbstractPolicy<P>>)
A pair of descriptors, one of which must be satisfied
Methods
impl<P> AbstractPolicy<P>
[src]
pub fn timelocks(&self) -> Vec<u32>
[src]
Returns a list of all timelocks, not including 0, which appear in the policy
pub fn before_time(self, time: u32) -> Option<AbstractPolicy<P>>
[src]
Filter an abstract policy by eliminating any timelock constraints.
If, after filtering, the policy cannot be satisfied, this function
returns None
.
pub fn n_keys(&self) -> usize
[src]
Count the number of public keys referenced in a policy. Note that duplicate keys will be double-counted.
pub fn minimum_n_keys(&self) -> usize
[src]
Count the minimum number of public keys for which signatures could be used to satisfy the policy.
impl<P: Ord> AbstractPolicy<P>
[src]
pub fn sort(self) -> AbstractPolicy<P>
[src]
"Sort" a policy to bring it into a canonical form to allow comparisons. This does not allow policies to be compared for functional equivalence; in general this appears to require Gröbner basis techniques that are not implemented.
Trait Implementations
impl<P: Eq> Eq for AbstractPolicy<P>
[src]
impl<P: PartialOrd> PartialOrd<AbstractPolicy<P>> for AbstractPolicy<P>
[src]
fn partial_cmp(&self, other: &AbstractPolicy<P>) -> Option<Ordering>
[src]
fn lt(&self, other: &AbstractPolicy<P>) -> bool
[src]
fn le(&self, other: &AbstractPolicy<P>) -> bool
[src]
fn gt(&self, other: &AbstractPolicy<P>) -> bool
[src]
fn ge(&self, other: &AbstractPolicy<P>) -> bool
[src]
impl<P: PartialEq> PartialEq<AbstractPolicy<P>> for AbstractPolicy<P>
[src]
fn eq(&self, other: &AbstractPolicy<P>) -> bool
[src]
fn ne(&self, other: &AbstractPolicy<P>) -> bool
[src]
impl<P: Clone> Clone for AbstractPolicy<P>
[src]
fn clone(&self) -> AbstractPolicy<P>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<P: Ord> Ord for AbstractPolicy<P>
[src]
fn cmp(&self, other: &AbstractPolicy<P>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl<P: Debug> Debug for AbstractPolicy<P>
[src]
Auto Trait Implementations
impl<P> Send for AbstractPolicy<P> where
P: Send,
P: Send,
impl<P> Sync for AbstractPolicy<P> where
P: Sync,
P: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,