sse_agent/lib.rs
1use {bytes::Bytes, futures_core::Stream};
2
3mod body;
4mod error;
5mod event;
6mod parser;
7
8pub use {
9 body::Body,
10 error::{Error, ErrorKind},
11 event::Event,
12};
13
14pub trait Sse<S> {
15 fn into_sse(self) -> Body<S>;
16}
17
18impl<S, E> Sse<S> for S
19where
20 S: Stream<Item = Result<Bytes, E>> + Unpin,
21 E: std::error::Error,
22{
23 fn into_sse(self) -> Body<S> {
24 Body::from(self)
25 }
26}