[][src]Struct multipart::mock::HttpBuffer

pub struct HttpBuffer {
    pub buf: Vec<u8>,
    pub boundary: String,
    pub content_len: Option<u64>,
    // some fields omitted
}

A writable buffer which stores the boundary and content-length, if provided.

Implements client::HttpStream if the client feature is enabled.

Fields

buf: Vec<u8>

The buffer containing the raw bytes.

boundary: String

The multipart boundary.

content_len: Option<u64>

The value of the content-length header, if set.

Implementations

impl HttpBuffer[src]

pub fn new_empty(boundary: String, content_len: Option<u64>) -> HttpBuffer

Notable traits for HttpBuffer

impl Write for HttpBuffer
[src]

Create an empty buffer with the given boundary and optional content-length.

pub fn with_buf(
    buf: Vec<u8>,
    boundary: String,
    content_len: Option<u64>
) -> Self
[src]

Wrap the given buffer with the given boundary and optional content-length.

pub fn for_server(&self) -> ServerRequest<'_>

Notable traits for ServerRequest<'a>

impl<'a> Read for ServerRequest<'a>
[src]

Get a ServerRequest wrapping the data in this buffer.

Trait Implementations

impl Debug for HttpBuffer[src]

impl HttpStream for HttpBuffer[src]

type Request = ClientRequest

The request type that opened this stream.

type Response = HttpBuffer

The response type that will be returned after the request is completed.

type Error = Error

The error type for this stream. Must be compatible with io::Error as well as Self::Request::Error. Read more

pub fn finish(self) -> Result<Self, Error>[src]

Returns Ok(self).

impl Write for HttpBuffer[src]

pub fn write(&mut self, buf: &[u8]) -> Result<usize>[src]

To simulate a network connection, this will copy a random number of bytes from buf to the buffer.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DebugAny for T where
    T: Any + Debug

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<T> UnsafeAny for T where
    T: Any

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

impl<W> WriteBytesExt for W where
    W: Write + ?Sized