pub struct ChunkedResponse { /* private fields */ }Expand description
Buffered response assembled from one or more pooled capture buffers.
This avoids reallocating or growing a single Vec on the hot path when
a multiline response is larger than the typical capture size.
ChunkedResponse is storage only. It intentionally does not expose response
boundary helpers such as prefix or terminator checks; callers that need to
interpret backend bytes must go through the session framer/backend facade
before putting data here.
Implementations§
Source§impl ChunkedResponse
impl ChunkedResponse
Sourcepub fn extend_from_slice(&mut self, pool: &BufferPool, data: &[u8])
pub fn extend_from_slice(&mut self, pool: &BufferPool, data: &[u8])
Append bytes using one or more pooled capture buffers.
§Panics
Panics if the internal chunk list becomes unexpectedly empty after a new capture buffer is acquired.
Sourcepub fn iter_chunks(&self) -> impl Iterator<Item = &[u8]>
pub fn iter_chunks(&self) -> impl Iterator<Item = &[u8]>
Iterate buffered chunks without flattening.
Sourcepub fn copy_prefix_into(&self, len: usize, out: &mut SmallVec<[u8; 128]>)
pub fn copy_prefix_into(&self, len: usize, out: &mut SmallVec<[u8; 128]>)
Copy up to len bytes from the front of the response into a small stack-backed buffer.
Sourcepub async fn write_all_to<W>(&self, writer: &mut W) -> Result<()>where
W: AsyncWriteExt + Unpin,
pub async fn write_all_to<W>(&self, writer: &mut W) -> Result<()>where
W: AsyncWriteExt + Unpin,
Write all buffered chunks to a sink in order.
§Errors
Returns any write error produced by the underlying async sink.
Trait Implementations§
Source§impl Debug for ChunkedResponse
impl Debug for ChunkedResponse
Source§impl Default for ChunkedResponse
impl Default for ChunkedResponse
Source§fn default() -> ChunkedResponse
fn default() -> ChunkedResponse
Source§impl From<ChunkedResponse> for CacheIngestResponse
impl From<ChunkedResponse> for CacheIngestResponse
Source§fn from(value: ChunkedResponse) -> Self
fn from(value: ChunkedResponse) -> Self
Auto Trait Implementations§
impl Freeze for ChunkedResponse
impl RefUnwindSafe for ChunkedResponse
impl Send for ChunkedResponse
impl Sync for ChunkedResponse
impl Unpin for ChunkedResponse
impl UnsafeUnpin for ChunkedResponse
impl UnwindSafe for ChunkedResponse
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
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> ⓘ
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> ⓘ
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