pub fn build(self) -> Result<Adaptive<B>> {
        let mut backoff = if self.backoff.is_some() && self.builder.is_some() {
            return Err(format_err!("adaptive builders from `.adaptive` on a backoff builder cannot be used with the `.backoff` function"));
        } else if let Some(boff) = self.backoff {
            boff
        } else if let Some(boff) = self.builder {
            boff.build()?
        } else {
            return Err(format_err!("backoff for adaptive backoff builder not specified, must use `.adaptive` on a backoff builder or `.backoff()`"));
        };
        // default to a clean initial backoff
        let base_delay = self.initial_delay.unwrap_or_else(|| {
            let d = backoff.wait();
            backoff.reset();
            d
        });
        let fail_mult = self.fail_mult.unwrap_or(1.0);
        let success_mult = self.success_mult.unwrap_or(1.0);

        Ok(Adaptive::<B> {
            backoff,
            fail_mult,
            success_mult,
            fail_factor: self.fail_factor.unwrap_or_default(),
            success_factor: self.success_factor.unwrap_or_default(),
            base_delay,
            delay: Duration::from_secs_f64(0.0),
            success_step: 1.0 / success_mult,
            fail_step: 1.0 / fail_mult,
        })
    }
/// build returns the adaptive backoff.
build returns the adaptive backoff.
build returns the adaptive backoff .
pub fn build(self) -> Result<Adaptive<B>> {
        let mut backoff = if self.backoff.is_some() && self.builder.is_some() {
            return Err(format_err!("adaptive builders from `.adaptive` on a backoff builder cannot be used with the `.backoff` function"));
        } else if let Some(boff) = self.backoff {
            boff
        } else if let Some(boff) = self.builder {
            boff.build()?
        } else {
            return Err(format_err!("backoff for adaptive backoff builder not specified, must use `.adaptive` on a backoff builder or `.backoff()`"));
        };
        // default to a clean initial backoff
        let base_delay = self.initial_delay.unwrap_or_else(|| {
            let d = backoff.wait();
            backoff.reset();
            d
        });
        let fail_mult = self.fail_mult.unwrap_or(1.0);
        let success_mult = self.success_mult.unwrap_or(1.0);
        Ok(Adaptive::<B> {
            backoff,
            fail_mult,
            success_mult,
            fail_factor: self.fail_factor.unwrap_or_default(),
            success_factor: self.success_factor.unwrap_or_default(),
            base_delay,
            delay: Duration::from_secs_f64(0.0),
            success_step: 1.0 / success_mult,
            fail_step: 1.0 / fail_mult,
        })
    }
pub fn build ( self ) -> Result < Adaptive < B > > { let mut backoff = if self . backoff . is_some ( ) && self . builder . is_some ( ) { return Err ( format_err ! ( " " ) ) ; } else if let Some ( boff ) = self . backoff { boff } else if let Some ( boff ) = self . builder { boff . build ( ) ? } else { return Err ( format_err ! ( " " ) ) ; } ; // default to a clean initial backoff let base_delay = self . initial_delay . unwrap_or_else ( | | { let d = backoff . wait ( ) ; backoff . reset ( ) ; d } ) ; let fail_mult = self . fail_mult . unwrap_or ( 1.0 ) ; let success_mult = self . success_mult . unwrap_or ( 1.0 ) ; Ok ( Adaptive :: < B > { backoff , fail_mult , success_mult , fail_factor : self . fail_factor . unwrap_or_default ( ) , success_factor : self . success_factor . unwrap_or_default ( ) , base_delay , delay : Duration :: from_secs_f64 ( 0.0 ) , success_step : 1.0 / success_mult , fail_step : 1.0 / fail_mult , } ) }
build returns the adaptive backoff.
build returns the adaptive backoff .
self
self