pub struct StreamReconnectPolicy {
pub max_attempts: u32,
pub delay: Duration,
pub require_event_id: bool,
pub max_delay: Duration,
pub deduplicate_replay: bool,
}Expand description
Opt-in transport reconnect policy for an already-started SSE stream.
Fields§
§max_attempts: u32Maximum number of reconnect attempts before the stream fails.
delay: DurationDelay between attempts, used when neither the server nor the parser
supplied a retry hint.
require_event_id: boolRefuse reconnect when no SSE event id has been observed.
max_delay: DurationRefuse reconnect delays above this cap (including server retry hints).
deduplicate_replay: boolSuppress a replayed suffix only when the server guarantees replay semantics. Off by default: inherited SSE IDs are not unique event identifiers.
Implementations§
Source§impl StreamReconnectPolicy
impl StreamReconnectPolicy
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates the default policy: 2 attempts, 250 ms delay, requiring an event id.
Sourcepub fn max_attempts(self, max_attempts: u32) -> Self
pub fn max_attempts(self, max_attempts: u32) -> Self
Sets the maximum number of reconnect attempts.
Sourcepub fn require_event_id(self, require_event_id: bool) -> Self
pub fn require_event_id(self, require_event_id: bool) -> Self
Sets whether reconnecting requires an observed SSE event id.
Sourcepub fn max_delay(self, max_delay: Duration) -> Self
pub fn max_delay(self, max_delay: Duration) -> Self
Sets the maximum permitted reconnect delay.
Sourcepub fn deduplicate_replay(self, enabled: bool) -> Self
pub fn deduplicate_replay(self, enabled: bool) -> Self
Enables suffix replay suppression for servers with documented resume semantics.
Trait Implementations§
Source§impl Clone for StreamReconnectPolicy
impl Clone for StreamReconnectPolicy
impl Copy for StreamReconnectPolicy
Source§impl Debug for StreamReconnectPolicy
impl Debug for StreamReconnectPolicy
Source§impl Default for StreamReconnectPolicy
impl Default for StreamReconnectPolicy
impl Eq for StreamReconnectPolicy
Source§impl PartialEq for StreamReconnectPolicy
impl PartialEq for StreamReconnectPolicy
impl StructuralPartialEq for StreamReconnectPolicy
Auto Trait Implementations§
impl Freeze for StreamReconnectPolicy
impl RefUnwindSafe for StreamReconnectPolicy
impl Send for StreamReconnectPolicy
impl Sync for StreamReconnectPolicy
impl Unpin for StreamReconnectPolicy
impl UnsafeUnpin for StreamReconnectPolicy
impl UnwindSafe for StreamReconnectPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.