pub struct Threshold {
pub threshold: usize,
pub subconditions: Vec<Condition>,
}Expand description
N-of-M threshold condition.
Satisfied when at least threshold of the subconditions verify
successfully. Subconditions can be any Condition variant,
including nested thresholds.
Fields§
§threshold: usizeMinimum number of valid subconditions required.
subconditions: Vec<Condition>Subconditions to evaluate.
Implementations§
Source§impl Threshold
impl Threshold
Sourcepub fn verify(&self) -> Result<(), Error>
pub fn verify(&self) -> Result<(), Error>
Verifies that at least self.threshold subconditions are satisfied.
A threshold of zero is rejected as malformed. A threshold exceeding the number of subconditions is likewise rejected, since it can never be met.
§Errors
Error::ZeroThresholdif threshold == 0.Error::ThresholdUnsatisfiableif threshold > subconditions.len().Error::ThresholdNotMetif fewer than threshold subconditions verify.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Threshold
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Threshold
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
impl Eq for Threshold
impl StructuralPartialEq for Threshold
Auto Trait Implementations§
impl Freeze for Threshold
impl RefUnwindSafe for Threshold
impl Send for Threshold
impl Sync for Threshold
impl Unpin for Threshold
impl UnsafeUnpin for Threshold
impl UnwindSafe for Threshold
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more