Skip to content

sse-stream 0.3.0

Latest

Choose a tag to compare

@4t145 4t145 released this 18 Sep 03:42
121c2ec

Changes

  • Shared SSE decoding for HTTP bodies and byte streams, with explicit terminal-error behavior.
  • Validated encoding: reject invalid event/id metadata; preserve multiline data and encode keep-alive comments safely.
  • Optional strict-fields feature: unknown fields become terminal errors. Disabled by default; Cargo feature unification applies this policy crate-wide.
  • Clarified raw-block semantics, metadata handling, and migration requirements.
  • Added a GPT-6 astra AI-assistance disclosure; MIT OR Apache-2.0 licensing is unchanged.

Breaking changes and migration

  • Replace Bytes::from(event) / event.into() with event.encode()? or Bytes::try_from(event)?.
  • KeepAlive::event now returns a result. SseBody returns BodyError; input errors must be convertible to a boxed Send + Sync error.
  • Use SseBody constructors and configuration methods instead of struct literals or direct keep-alive access.
  • Decoder/body errors are terminal. Obsolete parser error variants and deprecated from_byte_stream were removed; error enums are non-exhaustive.
  • Decoder Send/Sync auto traits now also depend on the input buffer type.

Full details: 0.3.0 migration notes.

sse-stream = "0.3"
# To reject unknown fields:
# sse-stream = { version = "0.3", features = ["strict-fields"] }

Performance

  • Direct byte-stream decoding avoids HTTP frame adaptation.
  • Default memchr scanning and simdutf8 long-field validation, with standard-library fallbacks.
  • Specialized data/comment/boundary paths, direct fragmented-data accumulation, and incremental event delivery.
  • Retained parser scratch buffers capped at 64 KiB each after completion; released on EOF/error. This is not an event-size limit.
  • Criterion coverage for 28 decoding and 5 encoding workloads. No unverified speedup claim over 0.2.6.

See benchmark methodology.

Validation: feature-matrix tests, Clippy, formatting, package verification, and the release workflow passed.

Full changelog: release-0.2.6...release-0.3.0