pub struct HttpRequest<S: State> { /* private fields */ }Expand description
An HTTP request in a specific state.
Implementations§
Source§impl<T: OptionTransferEncoding> HttpRequest<AwaitingRequestHeaders<T>>
impl<T: OptionTransferEncoding> HttpRequest<AwaitingRequestHeaders<T>>
Sourcepub fn header(&mut self, key: &str, value: &str) -> Result<(), HttpClientError>
pub fn header(&mut self, key: &str, value: &str) -> Result<(), HttpClientError>
Adds a header to the HTTP request.
Sourcepub fn no_body(
self,
) -> Result<HttpResponse<ReadResponseStatus>, HttpClientError>
pub fn no_body( self, ) -> Result<HttpResponse<ReadResponseStatus>, HttpClientError>
Finalizes the HTTP request without a body and sends it.
Source§impl HttpRequest<AwaitingRequestHeaders<TNone>>
impl HttpRequest<AwaitingRequestHeaders<TNone>>
Sourcepub fn body_with_size(
self,
size: usize,
) -> Result<HttpRequest<AwaitingRequestBody<FixedSizeTransferEncoding>>, HttpClientError>
pub fn body_with_size( self, size: usize, ) -> Result<HttpRequest<AwaitingRequestBody<FixedSizeTransferEncoding>>, HttpClientError>
Finalizes the HTTP request header section with fixed-size transfer encoding and awaits the request body.
Sourcepub fn body(
self,
) -> Result<HttpRequest<AwaitingRequestBody<ChunkedTransferEncoding>>, HttpClientError>
pub fn body( self, ) -> Result<HttpRequest<AwaitingRequestBody<ChunkedTransferEncoding>>, HttpClientError>
Finalizes the HTTP request header section with chunked transfer encoding and awaits the request body.
Source§impl HttpRequest<AwaitingRequestBody<FixedSizeTransferEncoding>>
impl HttpRequest<AwaitingRequestBody<FixedSizeTransferEncoding>>
Sourcepub fn response(
self,
) -> Result<HttpResponse<ReadResponseStatus>, HttpClientError>
pub fn response( self, ) -> Result<HttpResponse<ReadResponseStatus>, HttpClientError>
Finalizes the HTTP request and sends it, returning the HTTP response.
Source§impl HttpRequest<AwaitingRequestBody<ChunkedTransferEncoding>>
impl HttpRequest<AwaitingRequestBody<ChunkedTransferEncoding>>
Sourcepub fn response(
self,
) -> Result<HttpResponse<ReadResponseStatus>, HttpClientError>
pub fn response( self, ) -> Result<HttpResponse<ReadResponseStatus>, HttpClientError>
Finalizes the HTTP request and sends it, returning the HTTP response.
Trait Implementations§
Source§impl Write for HttpRequest<AwaitingRequestBody<ChunkedTransferEncoding>>
impl Write for HttpRequest<AwaitingRequestBody<ChunkedTransferEncoding>>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Source§impl Write for HttpRequest<AwaitingRequestBody<FixedSizeTransferEncoding>>
impl Write for HttpRequest<AwaitingRequestBody<FixedSizeTransferEncoding>>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<S> Freeze for HttpRequest<S>
impl<S> !RefUnwindSafe for HttpRequest<S>
impl<S> Send for HttpRequest<S>where
S: Send,
impl<S> !Sync for HttpRequest<S>
impl<S> Unpin for HttpRequest<S>where
S: Unpin,
impl<S> !UnwindSafe for HttpRequest<S>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.