require

Macro require 

Source
macro_rules! require {
    ($condition:expr, $fmt:literal $(, $arg:expr )* $(,)?) => { ... };
}
Expand description

Return a crate::LocalLawsError error with the given message when a condition is not met.

This macro only accepts literal format strings (with optional arguments) for consistent diagnostics.

ยงExample

use delta_local_laws::{
    LocalLawsError,
    require,
};

fn check_amount(amount: u64) -> Result<(), LocalLawsError> {
    require!(amount > 0, "amount must be > 0, got {}", amount);
    Ok(())
}