backoff 0.1.6

Retry operations with exponential backoff policy.
Documentation
use instant::Instant;

/// Clock returns the current time.
pub trait Clock {
    fn now(&self) -> Instant;
}

/// `SystemClock` uses the system's clock to get the current time.
/// This Clock should be used for real use-cases.
#[derive(Debug, Default)]
pub struct SystemClock {}

impl Clock for SystemClock {
    fn now(&self) -> Instant {
        Instant::now()
    }
}