pub struct ReconnectionConfig {
pub enabled: bool,
pub max_attempts: u32,
pub initial_delay: Duration,
pub max_delay: Duration,
}Expand description
Reconnection configuration
Controls automatic reconnection behavior after connection drops.
Construct via the derived ReconnectionConfig::builder (no validation,
fields default to the DEFAULT_* constants) or
via the validating positional constructor ReconnectionConfig::new.
enabled defaults to true in 0.4.0 — Rust users now get the
production-safe behaviour out of the box, aligning with reqwest /
redis-rs / tokio-tungstenite ergonomics. Bindings that need to
preserve the historical “no auto-reconnect” semantics of
fugle-marketdata-{python,node} SDKs MUST construct
ReconnectionConfig::disabled explicitly at the FFI boundary.
Fields§
§enabled: boolWhether auto-reconnect is active. When false, ReconnectionManager::should_reconnect
always returns false regardless of the close code.
max_attempts: u32Maximum reconnection attempts before giving up
initial_delay: DurationInitial delay before first reconnection attempt
max_delay: DurationMaximum delay between reconnection attempts
Implementations§
Source§impl ReconnectionConfig
impl ReconnectionConfig
Sourcepub fn builder() -> ReconnectionConfigBuilder
pub fn builder() -> ReconnectionConfigBuilder
Create an instance of ReconnectionConfig using the builder syntax
Source§impl ReconnectionConfig
impl ReconnectionConfig
Sourcepub fn new(
max_attempts: u32,
initial_delay: Duration,
max_delay: Duration,
) -> Result<ReconnectionConfig, MarketDataError>
pub fn new( max_attempts: u32, initial_delay: Duration, max_delay: Duration, ) -> Result<ReconnectionConfig, MarketDataError>
Create a new reconnection config with validation
§Errors
Returns MarketDataError::ConfigError if:
max_attemptsis 0 (must be >= 1)initial_delayis less than 100msmax_delayis less thaninitial_delay
Constructing via new() is treated as explicit opt-in, so the
returned config has enabled: true. To get a disabled config (e.g.
to fall back to “no reconnect at all”) use ReconnectionConfig::disabled
or ReconnectionConfig::default().
§Errors
Returns MarketDataError on transport, protocol, deserialization,
validation, or peer-initiated failures.
Sourcepub fn disabled() -> ReconnectionConfig
pub fn disabled() -> ReconnectionConfig
Build an explicitly disabled reconnection config.
should_reconnect() will always return false regardless of close code.
§Stability
Stable public API. FFI binding crates (fugle-marketdata-py,
fugle-marketdata-js, fugle-marketdata-uniffi) call this at the
FFI boundary to preserve their historical “no auto-reconnect”
semantics — see the tests/reconnect_default.rs workspace-level
gate. The function’s name and signature will be preserved across
every 0.x release; downstream code can rely on it.
Trait Implementations§
Source§impl Clone for ReconnectionConfig
impl Clone for ReconnectionConfig
Source§fn clone(&self) -> ReconnectionConfig
fn clone(&self) -> ReconnectionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more