pub struct Searcher { /* private fields */ }
Expand description
Performs a robust binary search over a linear range.
Implementations§
Source§impl Searcher
impl Searcher
Sourcepub fn new(len: usize) -> Self
pub fn new(len: usize) -> Self
Creates a new Searcher over a range with the given number of testable indices.
Sourcepub fn report(&mut self, index: usize, heads: bool, flakiness: f64)
pub fn report(&mut self, index: usize, heads: bool, flakiness: f64)
Adds a vote to the internal statistics. With low flakiness, false votes are expected to have smaller indices than true votes.
§Panics
Panics if index >= len
.
Sourcepub fn next_index(&self) -> usize
pub fn next_index(&self) -> usize
Returns the next index that should be tested. Can return values in the range 0 to len, exclusive.
Sourcepub fn best_index(&self) -> usize
pub fn best_index(&self) -> usize
Returns the current estimate of the best index. Can return values in the range 0 to len, inclusive.
Sourcepub fn likelihood(&self, index: usize) -> f64
pub fn likelihood(&self, index: usize) -> f64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Searcher
impl RefUnwindSafe for Searcher
impl Send for Searcher
impl Sync for Searcher
impl Unpin for Searcher
impl UnwindSafe for Searcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more