pub struct SseParser { /* private fields */ }Expand description
Incremental SSE (Server-Sent Events) parser.
Feed raw byte chunks via push and pull parsed
events via next_event. Each event is
returned as an (event_type, data) pair matching the
Event type alias used by transports.
Implementations§
Source§impl SseParser
impl SseParser
pub fn push(&mut self, chunk: &[u8])
Sourcepub fn next_event(&mut self) -> Option<(String, String)>
pub fn next_event(&mut self) -> Option<(String, String)>
Returns the next SSE event as (event_type, data).
event_typecomes from theevent:line (empty string if absent).datais the concatenateddata:line(s).
An event is emitted when a data: line is followed by either a blank
line or a new event: line, making the parser robust for streams that
may not always send blank-line separators between events.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SseParser
impl RefUnwindSafe for SseParser
impl Send for SseParser
impl Sync for SseParser
impl Unpin for SseParser
impl UnsafeUnpin for SseParser
impl UnwindSafe for SseParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more