pub struct QueueBuf(/* private fields */);
Expand description
QueueBuf is a queue of Buffer
.
It’s designed to allow storing multiple buffers without copying underlying bytes and consume them in order.
QueueBuf mainly provides the following operations:
push
: Push a new buffer in the queue.collect
: Collect all buffer in the queue as a newBuffer
advance
: Advance the queue bycnt
bytes.
Implementations§
Source§impl QueueBuf
impl QueueBuf
Sourcepub fn take(&mut self) -> QueueBuf
pub fn take(&mut self) -> QueueBuf
Take the entire buffer queue and leave self
in empty states.
Sourcepub fn collect(self) -> Buffer ⓘ
pub fn collect(self) -> Buffer ⓘ
Build a new Buffer
from the queue.
If the queue is empty, it will return an empty buffer. Otherwise, it will iterate over all buffers and collect them into a new buffer.
§Notes
There are allocation overheads when collecting multiple buffers into a new buffer. But most of them should be acceptable since we can expect the item length of buffers are slower than 4k.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueueBuf
impl RefUnwindSafe for QueueBuf
impl Send for QueueBuf
impl Sync for QueueBuf
impl Unpin for QueueBuf
impl UnwindSafe for QueueBuf
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Decompress response bodies. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more