/// Detect relations by removing calls dynamically.
///
/// The algorithm removes call before call `idx `of `p` and calls the callback
/// `changed` to verify if the removal changed the feedback of adjacent call.
/// For example, for prog [open, read], the algorithm removes `open` first and calls `changed`
/// with the index of `open` (0 in this case) and the `new_prog`. The index of `open` equals to
/// the index of `read` in the new `prog` and the callback `changed` should judge the feedback
/// changes of the `index` call after the execution of `new_prog`. Finally, `try_update` returns
/// the number of detected new relations.
Detect relations by removing calls dynamically.
Detect relations by removing calls dynamically .
pub fn try_update<T>(&mut self, p: &Prog, idx: usize, mut pred: T) -> bool
    where
        T: FnMut(&Prog, usize) -> bool, // fn(new_prog: &Prog, index: usize) -> bool
    {
        let mut found_new = false;
        if idx == 0 {
            return found_new;
        }
        let a = &p.calls[idx - 1];
        let b = &p.calls[idx];
        if !self.influence(a.sid(), b.sid()) {
            let new_p = p.remove_call(idx - 1);
            if pred(&new_p, idx - 1) {
                self.push_ordered(a.sid(), b.sid());
                found_new = true;
            }
        }
        found_new
    }
pub fn try_update < T > ( & mut self , p : & Prog , idx : usize , mut pred : T ) -> bool where T : FnMut ( & Prog , usize ) -> bool , // fn(new_prog: &Prog, index: usize) -> bool { let mut found_new = false ; if idx == 0 { return found_new ; } let a = & p . calls [ idx - 1 ] ; let b = & p . calls [ idx ] ; if ! self . influence ( a . sid ( ) , b . sid ( ) ) { let new_p = p . remove_call ( idx - 1 ) ; if pred ( & new_p , idx - 1 ) { self . push_ordered ( a . sid ( ) , b . sid ( ) ) ; found_new = true ; } } found_new }
Detect relations by removing calls dynamically.
Detect relations by removing calls dynamically .
&mut self
p
&Prog
idx
usize
pred
T