Repository navigation
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-fieldsfeature: 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()withevent.encode()?orBytes::try_from(event)?. KeepAlive::eventnow returns a result.SseBodyreturnsBodyError; input errors must be convertible to a boxed Send + Sync error.- Use
SseBodyconstructors 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_streamwere 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
memchrscanning andsimdutf8long-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.
Validation: feature-matrix tests, Clippy, formatting, package verification, and the release workflow passed.
Full changelog: release-0.2.6...release-0.3.0