Skip to main content

KimiClock

Trait KimiClock 

Source
pub trait KimiClock: Send + Sync {
    // Required methods
    fn now_millis(&self) -> u64;
    fn sleep_cancellable<'life0, 'life1, 'async_trait, X>(
        &'life0 self,
        duration: Duration,
        cancel: &'life1 X,
    ) -> Pin<Box<dyn Future<Output = Result<(), KimiAuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             X: 'async_trait + KimiCancel + ?Sized,
             Self: 'async_trait;
}
Expand description

Injectable clock (now + cancellable sleep) for deterministic poll tests.

Required Methods§

Source

fn now_millis(&self) -> u64

Source

fn sleep_cancellable<'life0, 'life1, 'async_trait, X>( &'life0 self, duration: Duration, cancel: &'life1 X, ) -> Pin<Box<dyn Future<Output = Result<(), KimiAuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, X: 'async_trait + KimiCancel + ?Sized, Self: 'async_trait,

Sleep duration, returning early with KimiAuthError::Cancelled when cancel flips.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§