2019-03-06 04:22:45 +00:00
|
|
|
macro_rules! verify {
|
|
|
|
($condition: expr, $result: expr) => {
|
2019-03-05 23:22:19 +00:00
|
|
|
if !$condition {
|
2019-03-06 04:22:45 +00:00
|
|
|
return Err(Error::Invalid($result));
|
2019-03-05 23:22:19 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2019-03-06 04:22:45 +00:00
|
|
|
|
|
|
|
macro_rules! invalid {
|
|
|
|
($result: expr) => {
|
|
|
|
return Err(Error::Invalid($result));
|
|
|
|
};
|
|
|
|
}
|
2019-03-07 00:32:53 +00:00
|
|
|
|
|
|
|
macro_rules! safe_add_assign {
|
|
|
|
($a: expr, $b: expr) => {
|
|
|
|
$a = $a.saturating_add($b);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
macro_rules! safe_sub_assign {
|
|
|
|
($a: expr, $b: expr) => {
|
|
|
|
$a = $a.saturating_sub($b);
|
|
|
|
};
|
|
|
|
}
|