pub struct Http1Body<R: AsyncRead + Unpin> { /* private fields */ }
Expand description

A HTTP/1 body.

The reason of this type and the inner buffer is described in super::Body::Http1

Implementations§

source§

impl<R: AsyncRead + Unpin> Http1Body<R>

source

pub fn new(reader: Arc<Mutex<R>>, bytes: Bytes, content_length: usize) -> Self

Creates a new body.

content_length should be the total length of the body, found in the Request::headers.

source

pub async fn read_to_bytes(&mut self, max_len: usize) -> Result<Bytes>

Reads all bytes from self to a Bytes.

Errors

Returns any errors from the underlying reader.

Trait Implementations§

source§

impl<R: AsyncRead + Unpin> AsyncRead for Http1Body<R>

source§

fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_> ) -> Poll<Result<()>>

Attempts to read from the AsyncRead into buf. Read more
source§

impl<R: AsyncRead + Unpin + Debug> Debug for Http1Body<R>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> !RefUnwindSafe for Http1Body<R>

§

impl<R> Send for Http1Body<R>where R: Send,

§

impl<R> Sync for Http1Body<R>where R: Send,

§

impl<R> Unpin for Http1Body<R>

§

impl<R> !UnwindSafe for Http1Body<R>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<R> AsyncReadExt for Rwhere R: AsyncRead + ?Sized,

§

fn chain<R>(self, next: R) -> Chain<Self, R>where Self: Sized, R: AsyncRead,

Creates a new AsyncRead instance that chains this stream with next. Read more
§

fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where Self: Unpin,

Pulls some bytes from this source into the specified buffer, returning how many bytes were read. Read more
§

fn read_buf<B, 'a>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>where Self: Sized + Unpin, B: BufMut,

Pulls some bytes from this source into the specified buffer, advancing the buffer’s internal cursor. Read more
§

fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where Self: Unpin,

Reads the exact number of bytes required to fill buf. Read more
§

fn read_u8<'a>(&'a mut self) -> ReadU8<&'a mut Self>where Self: Unpin,

Reads an unsigned 8 bit integer from the underlying reader. Read more
§

fn read_i8<'a>(&'a mut self) -> ReadI8<&'a mut Self>where Self: Unpin,

Reads a signed 8 bit integer from the underlying reader. Read more
§

fn read_u16<'a>(&'a mut self) -> ReadU16<&'a mut Self>where Self: Unpin,

Reads an unsigned 16-bit integer in big-endian order from the underlying reader. Read more
§

fn read_i16<'a>(&'a mut self) -> ReadI16<&'a mut Self>where Self: Unpin,

Reads a signed 16-bit integer in big-endian order from the underlying reader. Read more
§

fn read_u32<'a>(&'a mut self) -> ReadU32<&'a mut Self>where Self: Unpin,

Reads an unsigned 32-bit integer in big-endian order from the underlying reader. Read more
§

fn read_i32<'a>(&'a mut self) -> ReadI32<&'a mut Self>where Self: Unpin,

Reads a signed 32-bit integer in big-endian order from the underlying reader. Read more
§

fn read_u64<'a>(&'a mut self) -> ReadU64<&'a mut Self>where Self: Unpin,

Reads an unsigned 64-bit integer in big-endian order from the underlying reader. Read more
§

fn read_i64<'a>(&'a mut self) -> ReadI64<&'a mut Self>where Self: Unpin,

Reads an signed 64-bit integer in big-endian order from the underlying reader. Read more
§

fn read_u128<'a>(&'a mut self) -> ReadU128<&'a mut Self>where Self: Unpin,

Reads an unsigned 128-bit integer in big-endian order from the underlying reader. Read more
§

fn read_i128<'a>(&'a mut self) -> ReadI128<&'a mut Self>where Self: Unpin,

Reads an signed 128-bit integer in big-endian order from the underlying reader. Read more
§

fn read_f32<'a>(&'a mut self) -> ReadF32<&'a mut Self>where Self: Unpin,

Reads an 32-bit floating point type in big-endian order from the underlying reader. Read more
§

fn read_f64<'a>(&'a mut self) -> ReadF64<&'a mut Self>where Self: Unpin,

Reads an 64-bit floating point type in big-endian order from the underlying reader. Read more
§

fn read_u16_le<'a>(&'a mut self) -> ReadU16Le<&'a mut Self>where Self: Unpin,

Reads an unsigned 16-bit integer in little-endian order from the underlying reader. Read more
§

fn read_i16_le<'a>(&'a mut self) -> ReadI16Le<&'a mut Self>where Self: Unpin,

Reads a signed 16-bit integer in little-endian order from the underlying reader. Read more
§

fn read_u32_le<'a>(&'a mut self) -> ReadU32Le<&'a mut Self>where Self: Unpin,

Reads an unsigned 32-bit integer in little-endian order from the underlying reader. Read more
§

fn read_i32_le<'a>(&'a mut self) -> ReadI32Le<&'a mut Self>where Self: Unpin,

Reads a signed 32-bit integer in little-endian order from the underlying reader. Read more
§

fn read_u64_le<'a>(&'a mut self) -> ReadU64Le<&'a mut Self>where Self: Unpin,

Reads an unsigned 64-bit integer in little-endian order from the underlying reader. Read more
§

fn read_i64_le<'a>(&'a mut self) -> ReadI64Le<&'a mut Self>where Self: Unpin,

Reads an signed 64-bit integer in little-endian order from the underlying reader. Read more
§

fn read_u128_le<'a>(&'a mut self) -> ReadU128Le<&'a mut Self>where Self: Unpin,

Reads an unsigned 128-bit integer in little-endian order from the underlying reader. Read more
§

fn read_i128_le<'a>(&'a mut self) -> ReadI128Le<&'a mut Self>where Self: Unpin,

Reads an signed 128-bit integer in little-endian order from the underlying reader. Read more
§

fn read_f32_le<'a>(&'a mut self) -> ReadF32Le<&'a mut Self>where Self: Unpin,

Reads an 32-bit floating point type in little-endian order from the underlying reader. Read more
§

fn read_f64_le<'a>(&'a mut self) -> ReadF64Le<&'a mut Self>where Self: Unpin,

Reads an 64-bit floating point type in little-endian order from the underlying reader. Read more
§

fn read_to_end<'a>( &'a mut self, buf: &'a mut Vec<u8, Global> ) -> ReadToEnd<'a, Self>where Self: Unpin,

Reads all bytes until EOF in this source, placing them into buf. Read more
§

fn read_to_string<'a>( &'a mut self, dst: &'a mut String ) -> ReadToString<'a, Self>where Self: Unpin,

Reads all bytes until EOF in this source, appending them to buf. Read more
§

fn take(self, limit: u64) -> Take<Self>where Self: Sized,

Creates an adaptor which reads at most limit bytes from it. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 Twhere U: From<T>,

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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