pub fn bisect<F, L, R>(&self, f: F, indices: Indices) -> Step<L, R>
    where
        F: FnOnce(&T) -> ConvergeTo<L, R>,
    {
        let Indices { left, right } = indices;

        if left == right {
            return Step {
                indices,
                result: None,
            };
        }

        let middle = indices.middle();

        match f(&self.view[middle]) {
            ConvergeTo::Left(out) => Step {
                indices: Indices {
                    left,
                    right: middle,
                },
                result: Some(ConvergeTo::Left(out)),
            },
            ConvergeTo::Right(out) => Step {
                indices: Indices {
                    left: middle + 1,
                    right,
                },
                result: Some(ConvergeTo::Right(out)),
            },
        }
    }
/// Stateless implementation of the bisection method.
///
/// This method takes a convergence function `f` and indices `indices`.
///
/// The convergence function `f` is used to determine towards which side of the current view, the
/// bisection should progress.
///
/// Since this implementation is stateless, no internal state about the progression is stored.
/// Instead, indices of point from which the bisection method should be applied must be provided.
/// The method returns a [`Step`] struct as output. This `indices` property of this struct contains
/// the indices which point to the view to which the convergence function `f` converged, during
/// this step. In other words, the `Step::indices` may be used as input for the `indices` parameter
/// for the next bisection iteration.
///
/// As also described above, the `indices` argument must be the left and right index which point
/// to the view used by the current step of the bisection. The left and right index must be valid
/// indices for the slice held by the [`Bisector`] (also called the `view`).
///
/// See also:
/// * [`Bisector::try_bisect`]: A variant of [`bisect`] which can be used when the convergence function
///   is fallible.
///
/// [`Step`]: crate::Step
/// [`Bisector`]: crate::Bisector
/// [`Bisector::try_bisect`]: crate::Bisector::try_bisect
/// [`bisect`]: crate::Bisector::bisect
// Specialized version of a binary search which allows to return a special output value produced by the search
// function, instead of a customary index to the being searched value. Also, unlike the customary
// `while indices.left != indices.right` loop, the method takes the current indices (left, right)
// and returns the resulting indices as part of it's output.
Stateless implementation of the bisection method.
This method takes a convergence function `f` and indices `indices`.

The convergence function `f` is used to determine towards which side of the current view, the
bisection should progress.

Since this implementation is stateless, no internal state about the progression is stored.
Instead, indices of point from which the bisection method should be applied must be provided.
The method returns a [`Step`] struct as output. This `indices` property of this struct contains
the indices which point to the view to which the convergence function `f` converged, during
this step. In other words, the `Step::indices` may be used as input for the `indices` parameter
for the next bisection iteration.

As also described above, the `indices` argument must be the left and right index which point
to the view used by the current step of the bisection. The left and right index must be valid
indices for the slice held by the [`Bisector`] (also called the `view`).

See also:
[`Bisector::try_bisect`]: A variant of [`bisect`] which can be used when the convergence function
is fallible.


Stateless implementation of the bisection method . This method takes a convergence function ` f ` and indices ` indices ` . The convergence function ` f ` is used to determine towards which side of the current view the bisection should progress . Since this implementation is stateless no internal state about the progression is stored . Instead indices of point from which the bisection method should be applied must be provided . The method returns a [ ` Step ` ] struct as output . This ` indices ` property of this struct contains the indices which point to the view to which the convergence function ` f ` converged during this step . In other words the ` Step :: indices ` may be used as input for the ` indices ` parameter for the next bisection iteration . As also described above the ` indices ` argument must be the left and right index which point to the view used by the current step of the bisection . The left and right index must be valid indices for the slice held by the [ ` Bisector ` ] ( also called the ` view ` ) . See also : [ ` Bisector :: try_bisect ` ] : A variant of [ ` bisect ` ] which can be used when the convergence function is fallible .
pub fn bisect<F, L, R>(&self, f: F, indices: Indices) -> Step<L, R>
    where
        F: FnOnce(&T) -> ConvergeTo<L, R>,
    {
        let Indices { left, right } = indices;
        if left == right {
            return Step {
                indices,
                result: None,
            };
        }
        let middle = indices.middle();
        match f(&self.view[middle]) {
            ConvergeTo::Left(out) => Step {
                indices: Indices {
                    left,
                    right: middle,
                },
                result: Some(ConvergeTo::Left(out)),
            },
            ConvergeTo::Right(out) => Step {
                indices: Indices {
                    left: middle + 1,
                    right,
                },
                result: Some(ConvergeTo::Right(out)),
            },
        }
    }
pub fn bisect < F , L , R > ( & self , f : F , indices : Indices ) -> Step < L , R > where F : FnOnce ( & T ) -> ConvergeTo < L , R > , { let Indices { left , right } = indices ; if left == right { return Step { indices , result : None , } ; } let middle = indices . middle ( ) ; match f ( & self . view [ middle ] ) { ConvergeTo :: Left ( out ) => Step { indices : Indices { left , right : middle , } , result : Some ( ConvergeTo :: Left ( out ) ) , } , ConvergeTo :: Right ( out ) => Step { indices : Indices { left : middle + 1 , right , } , result : Some ( ConvergeTo :: Right ( out ) ) , } , } }
Stateless implementation of the bisection method.
Stateless implementation of the bisection method .
&self
f
F
indices
Indices