fn find_limit<T, F>(f: F) -> TExpand description
Internal algorithm of find_max() and find_min().
It works by performing f with a very large Duration onto
SaturatingTime::anchor() until this call returns None, in which case
this Duration gets halved. This process is repeated until f returns
None and the Duration has reached 1ns.
ยงAlgorithm
- Set
steptoINITIAL_STEPandrestoSaturatingTime::anchor(). - Call
f(&res, step).- If
Some, setresto the returned value and continue.- A
Somethat is equal to the previous value is considered as aNonedue to a long lived bug in the Rust standard library. - See Also: https://github.com/rust-lang/rust/issues/149995
- A
- If
Noneandstep == 1ns, returnres. - Else, set
steptoMAX{1ns, step / 2}and continue.
- If