rush_ecs_svm/
macros.rs

1#[macro_export]
2macro_rules! require {
3    ( $constraint:expr, $error:expr $(,)? ) => {
4        if !$constraint {
5            return Err($error.into());
6        }
7    };
8    ( $constraint:expr, $error:expr, $message:expr $(,)? ) => {
9        if !$constraint {
10            solana_program::msg!("Constraint failed: {}", $message);
11            return Err($error.into());
12        }
13    };
14    ( $constraint:expr, $error:expr, $message:literal, $($args:tt)+ ) => {
15        require!( $constraint, $error, format!($message, $($args)+) );
16    };
17}
18
19// TODO: assert_size (If I still have time)