Skip to main content

PingEngine

Trait PingEngine 

Source
pub trait PingEngine {
    // Required methods
    fn now(&self) -> EngineTime;
    fn send_probe(
        &mut self,
        request: ProbeRequest,
    ) -> Result<(), PingEngineError>;
    fn poll_until(
        &mut self,
        deadline: EngineTime,
    ) -> Result<Vec<TimedEvent>, PingEngineError>;
}

Required Methods§

Source

fn now(&self) -> EngineTime

Source

fn send_probe(&mut self, request: ProbeRequest) -> Result<(), PingEngineError>

Source

fn poll_until( &mut self, deadline: EngineTime, ) -> Result<Vec<TimedEvent>, PingEngineError>

Polls for the next event up to deadline.

Implementations must keep time monotonic. If there is an event at or before deadline, return all events for that exact timestamp and advance now() to that timestamp. If no event exists before deadline, advance to at least deadline and return an empty vector.

Real-time backends may need to catch up after a process pause/sleep. If deadline is already behind the backend’s wall-clock elapsed time, they may advance to “now” instead of stalling behind real time.

Implementors§