#[non_exhaustive]pub struct SseFrame {
pub event: SseEvent,
pub id: Option<String>,
}Expand description
A parsed SSE frame: the event and the id: line value (if any).
§id field semantics
RFC 8895 §9.2 distinguishes three id states:
- A frame with no
id:field → last event ID is unchanged. - A frame with a bare
id:field (no value) → last event ID is reset. - A frame with
id: <value>→ last event ID is updated to<value>.
This implementation conflates the first two cases: both produce id: None.
Callers implementing reconnect with Last-Event-ID should treat None as
“no change” and retain the previously-seen ID. The “reset” semantic is not
representable without a tri-state type; this simplification is intentional
for JMAP, where bare id: reset frames are rare in practice.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.event: SseEventThe parsed event payload from this SSE block.
id: Option<String>The value of the id: line if present (RFC 8895 §9.2); None when
the id: field is absent or bare (see the type-level docs for the
rationale behind conflating those two states).
Trait Implementations§
impl Eq for SseFrame
impl StructuralPartialEq for SseFrame
Auto Trait Implementations§
impl Freeze for SseFrame
impl RefUnwindSafe for SseFrame
impl Send for SseFrame
impl Sync for SseFrame
impl Unpin for SseFrame
impl UnsafeUnpin for SseFrame
impl UnwindSafe for SseFrame
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