pub struct NetworkLoopConfig<'a, A, E> {
pub action_cb: A,
pub on_err_cb: Option<E>,
pub description: &'a str,
pub interval: f64,
pub stop_rx: Option<Receiver<bool>>,
pub is_running: Option<Box<dyn Fn() -> bool + Send + Sync + 'a>>,
pub max_retries: i32,
pub repeat_on_success: bool,
}Expand description
Parameters for network_retry_loop.
Fields§
§action_cb: AThe async action to attempt on each iteration.
on_err_cb: Option<E>Optional error callback invoked when a TelegramError is caught.
description: &'a strHuman-readable label used in log messages.
interval: f64Base interval between attempts (seconds).
stop_rx: Option<Receiver<bool>>A watch receiver whose value, when true, signals the loop to stop.
Pass None if the loop should only be controlled by is_running and
max_retries.
is_running: Option<Box<dyn Fn() -> bool + Send + Sync + 'a>>Predicate checked at the top of every iteration. Returning false
exits the loop.
max_retries: i32Maximum retry count.
- negative: retry indefinitely.
- 0: no retries (single attempt).
- positive: up to N retries.
repeat_on_success: boolIf true, the action is repeated after a successful call.
Auto Trait Implementations§
impl<'a, A, E> Freeze for NetworkLoopConfig<'a, A, E>
impl<'a, A, E> !RefUnwindSafe for NetworkLoopConfig<'a, A, E>
impl<'a, A, E> Send for NetworkLoopConfig<'a, A, E>
impl<'a, A, E> Sync for NetworkLoopConfig<'a, A, E>
impl<'a, A, E> Unpin for NetworkLoopConfig<'a, A, E>
impl<'a, A, E> UnsafeUnpin for NetworkLoopConfig<'a, A, E>where
A: UnsafeUnpin,
E: UnsafeUnpin,
impl<'a, A, E> !UnwindSafe for NetworkLoopConfig<'a, A, E>
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