Struct hyper::proto::h1::io::Buffered

source ·
pub(crate) struct Buffered<T, B> {
    flush_pipeline: bool,
    io: T,
    read_blocked: bool,
    read_buf: BytesMut,
    read_buf_strategy: ReadStrategy,
    write_buf: WriteBuf<B>,
}

Fields§

§flush_pipeline: bool§io: T§read_blocked: bool§read_buf: BytesMut§read_buf_strategy: ReadStrategy§write_buf: WriteBuf<B>

Implementations§

source§

impl<T, B> Buffered<T, B>
where T: AsyncRead + AsyncWrite + Unpin, B: Buf,

source

pub(crate) fn new(io: T) -> Buffered<T, B>

source

pub(crate) fn set_flush_pipeline(&mut self, enabled: bool)

source

pub(crate) fn set_max_buf_size(&mut self, max: usize)

source

pub(crate) fn set_read_buf_exact_size(&mut self, sz: usize)

source

pub(crate) fn set_write_strategy_flatten(&mut self)

source

pub(crate) fn set_write_strategy_queue(&mut self)

source

pub(crate) fn read_buf(&self) -> &[u8]

source

fn read_buf_remaining_mut(&self) -> usize

Return the “allocated” available space, not the potential space that could be allocated in the future.

source

pub(crate) fn can_headers_buf(&self) -> bool

Return whether we can append to the headers buffer.

Reasons we can’t:

  • The write buf is in queue mode, and some of the past body is still needing to be flushed.
source

pub(crate) fn headers_buf(&mut self) -> &mut Vec<u8>

source

pub(super) fn write_buf(&mut self) -> &mut WriteBuf<B>

source

pub(crate) fn buffer<BB: Buf + Into<B>>(&mut self, buf: BB)

source

pub(crate) fn can_buffer(&self) -> bool

source

pub(crate) fn consume_leading_lines(&mut self)

source

pub(super) fn parse<S>( &mut self, cx: &mut Context<'_>, parse_ctx: ParseContext<'_>, ) -> Poll<Result<ParsedMessage<S::Incoming>>>

source

pub(crate) fn poll_read_from_io( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<usize>>

source

pub(crate) fn into_inner(self) -> (T, Bytes)

source

pub(crate) fn io_mut(&mut self) -> &mut T

source

pub(crate) fn is_read_blocked(&self) -> bool

source

pub(crate) fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>

source

fn poll_flush_flattened(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>

Specialized version of flush when strategy is Flatten.

Since all buffered bytes are flattened into the single headers buffer, that skips some bookkeeping around using multiple buffers.

Trait Implementations§

source§

impl<T, B> Debug for Buffered<T, B>
where B: Buf,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, B> MemRead for Buffered<T, B>
where T: AsyncRead + AsyncWrite + Unpin, B: Buf,

source§

fn read_mem(&mut self, cx: &mut Context<'_>, len: usize) -> Poll<Result<Bytes>>

source§

impl<T: Unpin, B> Unpin for Buffered<T, B>

Auto Trait Implementations§

§

impl<T, B> Freeze for Buffered<T, B>
where T: Freeze,

§

impl<T, B> RefUnwindSafe for Buffered<T, B>

§

impl<T, B> Send for Buffered<T, B>
where T: Send, B: Send,

§

impl<T, B> Sync for Buffered<T, B>
where T: Sync, B: Sync,

§

impl<T, B> UnwindSafe for Buffered<T, B>
where T: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more