pub struct SseDecoder { /* private fields */ }Expand description
Incremental SSE parser. Push bytes in with SseDecoder::feed; complete
events are returned as they are terminated by a blank line.
Mirrors _streaming.py::SSEDecoder field handling: event, data
(multi-line joined with \n), id (ignored if it contains NUL), retry,
comment lines (leading :), and a single leading space stripped from
values.
Implementations§
Source§impl SseDecoder
impl SseDecoder
pub fn new() -> Self
Sourcepub fn buffered_len(&self) -> usize
pub fn buffered_len(&self) -> usize
Bytes currently buffered awaiting a line terminator.
Sourcepub fn feed(&mut self, chunk: &[u8]) -> Vec<ServerSentEvent>
pub fn feed(&mut self, chunk: &[u8]) -> Vec<ServerSentEvent>
Feed a chunk of bytes; returns all events completed by this chunk.
Sourcepub fn flush(&mut self) -> Vec<ServerSentEvent>
pub fn flush(&mut self) -> Vec<ServerSentEvent>
Flush any trailing buffered line at end of stream.
Trait Implementations§
Source§impl Debug for SseDecoder
impl Debug for SseDecoder
Source§impl Default for SseDecoder
impl Default for SseDecoder
Source§fn default() -> SseDecoder
fn default() -> SseDecoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SseDecoder
impl RefUnwindSafe for SseDecoder
impl Send for SseDecoder
impl Sync for SseDecoder
impl Unpin for SseDecoder
impl UnsafeUnpin for SseDecoder
impl UnwindSafe for SseDecoder
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