/// Returns a new `SwitchReady`.
///
/// This will forward requests to the primary service, unless it takes over
/// `switch_after` duration to become ready. If the duration is exceeded,
/// the `secondary` service is used until the primary service becomes ready again.
Returns a new `SwitchReady`.
This will forward requests to the primary service, unless it takes over
`switch_after` duration to become ready. If the duration is exceeded,
the `secondary` service is used until the primary service becomes ready again.
Returns a new ` SwitchReady ` . This will forward requests to the primary service unless it takes over ` switch_after ` duration to become ready . If the duration is exceeded the ` secondary ` service is used until the primary service becomes ready again .
pub fn new(primary: A, secondary: B, switch_after: time::Duration) -> Self {
        Self {
            primary,
            secondary,
            switch_after,
            // The sleep is reset whenever the service becomes unready; this
            // initial one will never actually be used, so it's okay to start it
            // now.
            sleep: Box::pin(time::sleep(time::Duration::default())),
            state: State::Primary,
        }
    }
pub fn new ( primary : A , secondary : B , switch_after : time :: Duration ) -> Self { Self { primary , secondary , switch_after , // The sleep is reset whenever the service becomes unready; this // initial one will never actually be used, so it's okay to start it // now. sleep : Box :: pin ( time :: sleep ( time :: Duration :: default ( ) ) ) , state : State :: Primary , } }
Returns a new `SwitchReady`.
Returns a new ` SwitchReady ` .
primary
A
secondary
B
switch_after
time::Duration