[][src]Function topo::root

pub fn root<F, R>(op: F) -> R where
    F: FnOnce() -> R, 

Calls the provided function as the root of a new call tree, ignoring the current CallId.


// a call to root() here ensures the child is always treated as the same tree
// no matter from where the function is called
let independent = || topo::root(topo::CallId::current);
assert_eq!(topo::call(independent), topo::call(independent));

// this is a normal topo call, it returns `CallId`s based on the parent state
let dependent = || topo::call(topo::CallId::current);
assert_ne!(topo::call(dependent), topo::call(dependent));