pub fn verify_threshold(
    threshold: NumberOfNodes,
    number_of_receivers: NumberOfNodes,
) -> Result<(), InvalidArgumentError> {
    let min_threshold = NumberOfNodes::from(1);
    if threshold < min_threshold {
        return Err(InvalidArgumentError {
            message: format!(
                "Threshold to small:\n  Threshold: {}\n  minimum: {}",
                threshold, min_threshold
            ),
        });
    }

    if threshold > number_of_receivers {
        return Err(InvalidArgumentError {
            message: format!(
                "Threshold to large:\n  Threshold: {}\n  Number of receivers: {}",
                threshold, number_of_receivers
            ),
        });
    }
    Ok(())
}
/// Verifies that the threshold is at least 1 but not greater than the number of
/// receivers.
///
/// # Errors
/// * `InvalidArgumentError` if the threshold is less than 1.
/// * `InvalidArgumentError` if the threshold is greater than the number of
///   receivers.
Verifies that the threshold is at least 1 but not greater than the number of
receivers.
Verifies that the threshold is at least 1 but not greater than the number of receivers .
pub fn verify_threshold(
    threshold: NumberOfNodes,
    number_of_receivers: NumberOfNodes,
) -> Result<(), InvalidArgumentError> {
    let min_threshold = NumberOfNodes::from(1);
    if threshold < min_threshold {
        return Err(InvalidArgumentError {
            message: format!(
                "Threshold to small:\n  Threshold: {}\n  minimum: {}",
                threshold, min_threshold
            ),
        });
    }
    if threshold > number_of_receivers {
        return Err(InvalidArgumentError {
            message: format!(
                "Threshold to large:\n  Threshold: {}\n  Number of receivers: {}",
                threshold, number_of_receivers
            ),
        });
    }
    Ok(())
}
pub fn verify_threshold ( threshold : NumberOfNodes , number_of_receivers : NumberOfNodes , ) -> Result < ( ) , InvalidArgumentError > { let min_threshold = NumberOfNodes :: from ( 1 ) ; if threshold < min_threshold { return Err ( InvalidArgumentError { message : format ! ( " \n \n " threshold min_threshold ) , } ) ; } if threshold > number_of_receivers { return Err ( InvalidArgumentError { message : format ! ( " \n \n " threshold number_of_receivers ) , } ) ; } Ok ( ( ) ) }
Verifies that the threshold is at least 1 but not greater than the number of
receivers.
Verifies that the threshold is at least 1 but not greater than the number of receivers .
threshold
NumberOfNodes
number_of_receivers
NumberOfNodes
threshold
NumberOfNodes
number_of_receivers
NumberOfNodes
errors
`InvalidArgumentError` if the threshold is less than 1.
`InvalidArgumentError` if the threshold is greater than the number of
receivers.
` InvalidArgumentError ` if the threshold is less than 1 . ` InvalidArgumentError ` if the threshold is greater than the number of receivers .