pub struct SseEventParser { /* private fields */ }Expand description
Stateful SSE event parser. Feed it complete LF-delimited lines via
Self::push_line; it emits a complete SseEvent each time it
sees a terminator blank line per W3C spec.
Implementations§
Source§impl SseEventParser
impl SseEventParser
pub fn new() -> Self
Sourcepub fn push_line(&mut self, line: &str) -> Option<SseEvent>
pub fn push_line(&mut self, line: &str) -> Option<SseEvent>
Push one complete line. Returns Some(event) iff the line
terminated an event (blank line); None while still
accumulating fields.
Per W3C §“event stream interpretation”:
event: <name>→ set event nameid: <id>→ set last event iddata: <line>→ append (with newline) to data bufferretry: <ms>→ set retry hint<empty line>→ dispatch accumulated event: <comment>→ ignore (comment line)- other → ignore (unknown field)
Trait Implementations§
Source§impl Debug for SseEventParser
impl Debug for SseEventParser
Source§impl Default for SseEventParser
impl Default for SseEventParser
Source§fn default() -> SseEventParser
fn default() -> SseEventParser
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SseEventParser
impl RefUnwindSafe for SseEventParser
impl Send for SseEventParser
impl Sync for SseEventParser
impl Unpin for SseEventParser
impl UnsafeUnpin for SseEventParser
impl UnwindSafe for SseEventParser
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.