pub struct PollGuard { /* private fields */ }Expand description
Per-poll-operation state machine that handles backoff, error classification, and consecutive-empty tracking.
Create one per (exchange, poll_type) — fills and quotes can fail
independently and need separate backoff clocks.
Implementations§
Source§impl PollGuard
impl PollGuard
Sourcepub fn new(label: &'static str, config: &RunnerConfig) -> Self
pub fn new(label: &'static str, config: &RunnerConfig) -> Self
Create a new guard with backoff config derived from RunnerConfig.
Sourcepub async fn execute<T, F, Fut>(&mut self, poll_fn: F) -> PollOutcome<T>
pub async fn execute<T, F, Fut>(&mut self, poll_fn: F) -> PollOutcome<T>
Execute a poll with built-in backoff + error handling.
The skeleton:
- Apply current backoff delay (if any).
- Call
poll_fn. - Classify the result and update internal state.
- Return a clean
PollOutcomeso the caller only handles data.
Sourcepub fn looks_exhausted(&self, threshold: u32) -> bool
pub fn looks_exhausted(&self, threshold: u32) -> bool
Check if the poll source looks exhausted.
Used by the runner for backtest exit detection:
if delay == 0 && guard.looks_exhausted(3) { break; }
Auto Trait Implementations§
impl Freeze for PollGuard
impl RefUnwindSafe for PollGuard
impl Send for PollGuard
impl Sync for PollGuard
impl Unpin for PollGuard
impl UnsafeUnpin for PollGuard
impl UnwindSafe for PollGuard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more