Struct multipart::mock::HttpBuffer [−][src]
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.
Methods
impl HttpBuffer
[src]
impl HttpBuffer
ⓘImportant traits for HttpBufferpub fn new_empty(boundary: String, content_len: Option<u64>) -> HttpBuffer
[src]
pub fn new_empty(boundary: String, content_len: Option<u64>) -> HttpBuffer
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]
pub fn with_buf(
buf: Vec<u8>,
boundary: String,
content_len: Option<u64>
) -> Self
Wrap the given buffer with the given boundary and optional content-length.
ⓘImportant traits for ServerRequest<'a>pub fn for_server(&self) -> ServerRequest
[src]
pub fn for_server(&self) -> ServerRequest
Get a ServerRequest
wrapping the data in this buffer.
Trait Implementations
impl Write for HttpBuffer
[src]
impl Write for HttpBuffer
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
To simulate a network connection, this will copy a random number of bytes
from buf
to the buffer.
fn flush(&mut self) -> Result<()>
[src]
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
Writes a formatted string into this writer, returning any error encountered. Read more
ⓘImportant traits for &'a mut Rfn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
Creates a "by reference" adaptor for this instance of Write
. Read more
impl HttpStream for HttpBuffer
[src]
impl HttpStream for HttpBuffer
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
fn finish(self) -> Result<Self, Error>
[src]
fn finish(self) -> Result<Self, Error>
Returns Ok(self)
.
impl Debug for HttpBuffer
[src]
impl Debug for HttpBuffer
Auto Trait Implementations
impl !Send for HttpBuffer
impl !Send for HttpBuffer
impl !Sync for HttpBuffer
impl !Sync for HttpBuffer