pub struct BackoffInterval {
pub min_ms: MillisNonZero,
pub max_ms: MillisNonZero,
}Expand description
Timeout floor and ceiling parsed from a duration-range string.
Format: <min>..<max> (e.g., 10ms..60s).
Both bounds use MillisNonZero — they are always positive.
Unit designators are compatible with jiff’s friendly duration format, which is what restate uses for configuration parsing.
§Parsing
use adaptive_timeout::BackoffInterval;
let b: BackoffInterval = "10ms..60s".parse().unwrap();
assert_eq!(b.min_ms.get(), 10);
assert_eq!(b.max_ms.get(), 60_000);
// Jiff-style compact designators work:
let b: BackoffInterval = "250ms..1m".parse().unwrap();
assert_eq!(b.min_ms.get(), 250);
assert_eq!(b.max_ms.get(), 60_000);
// Verbose designators too:
let b: BackoffInterval = "500 milliseconds..2 minutes".parse().unwrap();
assert_eq!(b.min_ms.get(), 500);
assert_eq!(b.max_ms.get(), 120_000);Fields§
§min_ms: MillisNonZeroFloor for computed timeout in milliseconds. Default: 250ms.
max_ms: MillisNonZeroCeiling for computed timeout in milliseconds. Default: 60,000ms (1min).
Trait Implementations§
Source§impl Clone for BackoffInterval
impl Clone for BackoffInterval
Source§fn clone(&self) -> BackoffInterval
fn clone(&self) -> BackoffInterval
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackoffInterval
impl Debug for BackoffInterval
Source§impl Default for BackoffInterval
impl Default for BackoffInterval
Source§impl Display for BackoffInterval
impl Display for BackoffInterval
Source§impl From<BackoffInterval> for TimeoutConfig
Convert a BackoffInterval into a TimeoutConfig.
impl From<BackoffInterval> for TimeoutConfig
Convert a BackoffInterval into a TimeoutConfig.
Quantile and safety factor remain at defaults.
Source§fn from(backoff: BackoffInterval) -> Self
fn from(backoff: BackoffInterval) -> Self
Converts to this type from the input type.
Source§impl FromStr for BackoffInterval
impl FromStr for BackoffInterval
Source§impl PartialEq for BackoffInterval
impl PartialEq for BackoffInterval
impl Copy for BackoffInterval
impl Eq for BackoffInterval
impl StructuralPartialEq for BackoffInterval
Auto Trait Implementations§
impl Freeze for BackoffInterval
impl RefUnwindSafe for BackoffInterval
impl Send for BackoffInterval
impl Sync for BackoffInterval
impl Unpin for BackoffInterval
impl UnsafeUnpin for BackoffInterval
impl UnwindSafe for BackoffInterval
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