Struct stream_httparse::Response [−][src]
Represents a single HTTP-Request
Implementations
impl<'a> Response<'a>
[src]
pub fn new(
protocol: &'a str,
status_code: StatusCode,
headers: Headers<'a>,
body: Vec<u8>
) -> Self
[src]
protocol: &'a str,
status_code: StatusCode,
headers: Headers<'a>,
body: Vec<u8>
) -> Self
Creates a new Response with the given Data as its inital State
pub fn serialize(&self) -> (Vec<u8>, &[u8])
[src]
Serialzes the Response and returns the Data as a tuple of form (HTTP-Head, HTTP-Body)
pub fn protocol(&self) -> &str
[src]
Returns the Protocol of the Response
pub fn status_code(&self) -> &StatusCode
[src]
Returns the StatusCode of the Response
pub fn headers(&self) -> &Headers<'a>
[src]
Returns the Headers of the Response
pub fn body(&self) -> &[u8]
[src]
Returns the Body of the Response
pub fn add_header<'b, K, V>(&mut self, key: K, value: V) where
'b: 'a,
K: Into<HeaderKey<'a>>,
V: Into<HeaderValue<'a>>,
[src]
'b: 'a,
K: Into<HeaderKey<'a>>,
V: Into<HeaderValue<'a>>,
Adds the Key-Value Pair as a new Header to the Response or replaces the old Value of the Header if it already existed on the Response
pub fn set_body(&mut self, n_body: Vec<u8>)
[src]
Replaces the old Body of the Response with the new given Body and updates the Content-Length Header as well with the new Length
pub fn is_chunked(&self) -> bool
[src]
Checks if the Response is send using
Transfer-Encoding: Chunked
Trait Implementations
impl<'a> Debug for Response<'a>
[src]
impl<'a> PartialEq<Response<'a>> for Response<'a>
[src]
impl<'a> StructuralPartialEq for Response<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Response<'a>
impl<'a> Send for Response<'a>
impl<'a> Sync for Response<'a>
impl<'a> Unpin for Response<'a>
impl<'a> UnwindSafe for Response<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,