pub struct LineBuffer { /* private fields */ }Expand description
Accumulates raw bytes and yields complete \n-terminated lines. Partial
trailing data is preserved across calls. Tolerates \r\n and mixed UTF-8
by accumulating bytes first and only converting to &str per complete line.
Implementations§
Source§impl LineBuffer
impl LineBuffer
pub fn new() -> Self
Sourcepub fn push(&mut self, bytes: &[u8]) -> Vec<String>
pub fn push(&mut self, bytes: &[u8]) -> Vec<String>
Append bytes and return every complete line that is now available.
The returned strings have any trailing \r stripped and do NOT include
the terminating \n.
Sourcepub fn take_remaining(&mut self) -> Option<String>
pub fn take_remaining(&mut self) -> Option<String>
Drain anything left without requiring a final newline. Useful when the
upstream closes without flushing a trailing \n.
Trait Implementations§
Source§impl Default for LineBuffer
impl Default for LineBuffer
Source§fn default() -> LineBuffer
fn default() -> LineBuffer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LineBuffer
impl RefUnwindSafe for LineBuffer
impl Send for LineBuffer
impl Sync for LineBuffer
impl Unpin for LineBuffer
impl UnsafeUnpin for LineBuffer
impl UnwindSafe for LineBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more