pub struct HttpResponseBinary { /* private fields */ }
Expand description
A struct representing an HTTP response.
This struct contains all the components of an HTTP response: the HTTP version, status code, status text, headers, and body. It is used to model and manipulate HTTP responses within the application.
§Fields
http_version
: A string representing the HTTP version.status_code
: The HTTP status code.status_text
: A string containing the status text associated with the status code.headers
: AHashMap<String, String>
containing the headers of the response, where each key is the header name and the value is the corresponding header value.body
: AVec<u8>
representing the body of the HTTP response, which contains the content being returned.
Implementations§
Source§impl HttpResponseBinary
impl HttpResponseBinary
Sourcepub fn get_http_version(&self) -> HttpVersion
pub fn get_http_version(&self) -> HttpVersion
Sourcepub fn get_status_code(&self) -> usize
pub fn get_status_code(&self) -> usize
Sourcepub fn get_status_text(&self) -> String
pub fn get_status_text(&self) -> String
Sourcepub fn get_headers(
&self,
) -> HashMap<String, VecDeque<String>, BuildHasherDefault<Hasher>>
pub fn get_headers( &self, ) -> HashMap<String, VecDeque<String>, BuildHasherDefault<Hasher>>
Trait Implementations§
Source§impl Clone for HttpResponseBinary
impl Clone for HttpResponseBinary
Source§fn clone(&self) -> HttpResponseBinary
fn clone(&self) -> HttpResponseBinary
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HttpResponseBinary
impl Debug for HttpResponseBinary
Source§impl Default for HttpResponseBinary
Default implementation for HttpResponseBinary.
impl Default for HttpResponseBinary
Default implementation for HttpResponseBinary.
§Returns
HttpResponseBinary
- Default initialized HttpResponseBinary.
Source§fn default() -> HttpResponseBinary
fn default() -> HttpResponseBinary
Returns the “default value” for a type. Read more
Source§impl ResponseTrait for HttpResponseBinary
Implements the ResponseTrait
trait for HttpResponseBinary
.
impl ResponseTrait for HttpResponseBinary
Implements the ResponseTrait
trait for HttpResponseBinary
.
This implementation specifies the associated types for binary and text representations of HTTP responses, enabling seamless conversion and handling of HTTP response data.
§Associated Types
OutputText
: Specifies the text representation of an HTTP response (HttpResponseText
).OutputBinary
: Specifies the binary representation of an HTTP response (HttpResponseBinary
).
Source§fn from(response: &[u8]) -> HttpResponseBinarywhere
HttpResponseBinary: Sized,
fn from(response: &[u8]) -> HttpResponseBinarywhere
HttpResponseBinary: Sized,
Source§fn binary(&self) -> <HttpResponseBinary as ResponseTrait>::OutputBinary
fn binary(&self) -> <HttpResponseBinary as ResponseTrait>::OutputBinary
Converts the response to binary format.
§Returns
Self::OutputBinary
- The binary representation of the response.
Source§fn text(&self) -> HttpResponseText
fn text(&self) -> HttpResponseText
Converts the response to text format.
§Returns
HttpResponseText
- The text representation of the response.
Source§fn decode(&self, buffer_size: usize) -> HttpResponseBinary
fn decode(&self, buffer_size: usize) -> HttpResponseBinary
type OutputText = HttpResponseText
type OutputBinary = HttpResponseBinary
Auto Trait Implementations§
impl Freeze for HttpResponseBinary
impl RefUnwindSafe for HttpResponseBinary
impl Send for HttpResponseBinary
impl Sync for HttpResponseBinary
impl Unpin for HttpResponseBinary
impl UnwindSafe for HttpResponseBinary
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more