Skip to main content

CopilotClock

Trait CopilotClock 

Source
pub trait CopilotClock: 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<(), CopilotAuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             X: 'async_trait + CopilotCancel + ?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<(), CopilotAuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, X: 'async_trait + CopilotCancel + ?Sized, Self: 'async_trait,

Sleep duration, returning early with CopilotAuthError::Cancelled when cancel flips. Implementations must check cancellation at least every quantum (not only after the full sleep).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§