1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! # stream-rs
//!
//! A zero-dependency, spec-compliant streaming toolkit for LLM responses.
//!
//! It gives you the low-level plumbing that sits *underneath* an LLM client —
//! none of the model, transport, or API-key concerns, just the parsing that
//! turns a raw byte stream into usable values:
//!
//! * [`sse`] — a WHATWG-compliant Server-Sent Events push parser.
//! * [`incremental_json`] — a byte-level splitter that finds complete top-level
//! JSON values in a chunked stream (NDJSON or bare concatenation).
//! * [`accumulators`] — fold provider-specific streaming deltas
//! ([`OpenAI`](accumulators::openai), [Anthropic](accumulators::anthropic),
//! and [Gemini](accumulators::gemini)) back into the final message content.
//!
//! The core has **no runtime dependencies**. An optional `stream` feature adds
//! a [`futures_core::Stream`] adapter ([`stream::SseStream`]) for async byte
//! sources; enable it with `features = ["stream"]`.
//!
//! ## `no_std`
//!
//! The crate is `#![no_std]` and needs only `alloc`. The default `std` feature
//! merely adds [`std::error::Error`] impls for the error types; disable it for
//! embedded / wasm targets:
//!
//! ```toml
//! stream-rs = { version = "0.1", default-features = false }
//! ```
//!
//! ## Quick start
//!
//! ```
//! use stream_rs::sse::SseParser;
//!
//! let mut parser = SseParser::new();
//! let mut events = Vec::new();
//! parser.feed(b"data: {\"hello\":true}\n\n", &mut events);
//!
//! assert_eq!(events[0].data, "{\"hello\":true}");
//! ```
extern crate alloc;
extern crate std;
pub use ;
pub use ;
pub use ;