Only the logged passthrough stream got batched SSE framing; the 13 other
call sites still went through take_sse_block, which allocates a String per
event and shifts the rest of the buffer once per event. The whole-body
aggregators (Responses/Chat SSE -> JSON, Anthropic SSE -> message) copied
the full body first, so draining was O(events x body).
- Add SseBuffer for streamed bodies: events are slices of the buffer,
consumed text is dropped once per chunk, and a scan that found no
delimiter resumes near the end instead of rescanning a long partial
event. It owns the split-UTF-8 remainder, and take_tail() keeps the
existing lossy flush at EOF.
- Add SseBlocks, a borrowing iterator with remainder() for complete
bodies, so aggregators no longer copy or drain the body.
- Port every take_sse_block / find_sse_block caller and remove both.
Event boundaries, the trailing-event fallback and clear() semantics
are unchanged.
Release microbenchmark (old main / previous PR commit / this commit):
4096 events in one chunk 668ms / 15.9ms / 0.15ms
64 events x 512 chunks 91.7ms / 2.7ms / 0.97ms
2 MiB event, 16 KiB chunks 111ms / 10.8ms / 1.6ms
whole body, 20k events 15.3s / 1.26s / 0.49ms
cargo clippy --lib -D warnings is clean; cargo test --lib: 4305 passed.