pub fn apply_witness(&mut self, witness: &Witness, from: &Pubkey) {
        let new_expr = match self {
            BudgetExpr::After(cond, sub_expr) if cond.is_satisfied(witness, from) => {
                Some(sub_expr.clone())
            }
            BudgetExpr::Or((cond, sub_expr), _) if cond.is_satisfied(witness, from) => {
                Some(sub_expr.clone())
            }
            BudgetExpr::Or(_, (cond, sub_expr)) if cond.is_satisfied(witness, from) => {
                Some(sub_expr.clone())
            }
            BudgetExpr::And(cond0, cond1, sub_expr) => {
                if cond0.is_satisfied(witness, from) {
                    Some(Box::new(BudgetExpr::After(cond1.clone(), sub_expr.clone())))
                } else if cond1.is_satisfied(witness, from) {
                    Some(Box::new(BudgetExpr::After(cond0.clone(), sub_expr.clone())))
                } else {
                    None
                }
            }
            _ => None,
        };
        if let Some(expr) = new_expr {
            *self = *expr;
        }
    }
/// Apply a witness to the budget to see if the budget can be reduced.
/// If so, modify the budget in-place.
Apply a witness to the budget to see if the budget can be reduced.
If so, modify the budget in-place.
Apply a witness to the budget to see if the budget can be reduced . If so modify the budget in - place .
pub fn apply_witness(&mut self, witness: &Witness, from: &Pubkey) {
        let new_expr = match self {
            BudgetExpr::After(cond, sub_expr) if cond.is_satisfied(witness, from) => {
                Some(sub_expr.clone())
            }
            BudgetExpr::Or((cond, sub_expr), _) if cond.is_satisfied(witness, from) => {
                Some(sub_expr.clone())
            }
            BudgetExpr::Or(_, (cond, sub_expr)) if cond.is_satisfied(witness, from) => {
                Some(sub_expr.clone())
            }
            BudgetExpr::And(cond0, cond1, sub_expr) => {
                if cond0.is_satisfied(witness, from) {
                    Some(Box::new(BudgetExpr::After(cond1.clone(), sub_expr.clone())))
                } else if cond1.is_satisfied(witness, from) {
                    Some(Box::new(BudgetExpr::After(cond0.clone(), sub_expr.clone())))
                } else {
                    None
                }
            }
            _ => None,
        };
        if let Some(expr) = new_expr {
            *self = *expr;
        }
    }
pub fn apply_witness ( & mut self , witness : & Witness , from : & Pubkey ) { let new_expr = match self { BudgetExpr :: After ( cond , sub_expr ) if cond . is_satisfied ( witness , from ) => { Some ( sub_expr . clone ( ) ) } BudgetExpr :: Or ( ( cond , sub_expr ) , _ ) if cond . is_satisfied ( witness , from ) => { Some ( sub_expr . clone ( ) ) } BudgetExpr :: Or ( _ , ( cond , sub_expr ) ) if cond . is_satisfied ( witness , from ) => { Some ( sub_expr . clone ( ) ) } BudgetExpr :: And ( cond0 , cond1 , sub_expr ) => { if cond0 . is_satisfied ( witness , from ) { Some ( Box :: new ( BudgetExpr :: After ( cond1 . clone ( ) , sub_expr . clone ( ) ) ) ) } else if cond1 . is_satisfied ( witness , from ) { Some ( Box :: new ( BudgetExpr :: After ( cond0 . clone ( ) , sub_expr . clone ( ) ) ) ) } else { None } } _ => None , } ; if let Some ( expr ) = new_expr { * self = * expr ; } }
Apply a witness to the budget to see if the budget can be reduced.
Apply a witness to the budget to see if the budget can be reduced .
&mut self
witness
&Witness
from
&Pubkey