pub struct NdjsonFramer { /* private fields */ }Expand description
Splits nonempty newline-delimited payloads without validating JSON.
A nonempty unterminated last line is available through Self::finish.
A line counts its bytes before its line end, LF or CRLF.
Implementations§
Source§impl NdjsonFramer
impl NdjsonFramer
Sourcepub fn new() -> Self
pub fn new() -> Self
A framer at the start of a stream, refusing a line past
FRAME_LIMIT.
Sourcepub fn with_limit(limit: usize) -> Self
pub fn with_limit(limit: usize) -> Self
A framer at the start of a stream, refusing a line of more than
limit bytes.
Sourcepub fn push(&mut self, chunk: &[u8]) -> Drain<'_, Result<Vec<u8>, TooLarge>> ⓘ
pub fn push(&mut self, chunk: &[u8]) -> Drain<'_, Result<Vec<u8>, TooLarge>> ⓘ
Feed one transport chunk; yields every line it completed, and
TooLarge in the place of a line longer than the limit, whose
rest up to its LF it skips. Blank lines are not frames. The chunk
goes in by pieces no larger than the room left, so the framer never
holds more than one byte past the limit.
Trait Implementations§
Source§impl Debug for NdjsonFramer
impl Debug for NdjsonFramer
Auto Trait Implementations§
impl Forget for NdjsonFramer
impl Freeze for NdjsonFramer
impl Move for NdjsonFramer
impl RefUnwindSafe for NdjsonFramer
impl Send for NdjsonFramer
impl Sync for NdjsonFramer
impl Unpin for NdjsonFramer
impl UnsafeUnpin for NdjsonFramer
impl UnwindSafe for NdjsonFramer
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