[−][src]Struct http_str::Response
Fields
response: &'a str
version: &'a str
status_phrase: &'a str
headers_map: BTreeMap<&'a str, Vec<&'a str>>
body: &'a str
status: &'a str
Methods
impl<'a> Response<'a>
[src]
pub fn new(
version: &'a str,
status: u16,
headers_map: BTreeMap<&'a str, Vec<&'a str>>,
body: &'a str,
response_out: &'a mut String
) -> Pin<Box<Self>>
[src]
version: &'a str,
status: u16,
headers_map: BTreeMap<&'a str, Vec<&'a str>>,
body: &'a str,
response_out: &'a mut String
) -> Pin<Box<Self>>
Creates a new Response from their http version,a status code,a map which hash the values of the headers in a vec by their name, the body of the response and a mutable reference to an empty String(this might change in the future 'cause it is a lifetime hack but one notable advantange of this is the freedom of choose the capacity of the String based in your application).
After that,you can access the field response for the full response String as well the headers_map, status, status_phrase, body and the version string slices of the response. The previous identical data passed to this function get dropped.
pub fn from_bytes(bytes: &'a [u8]) -> Pin<Box<Self>>
[src]
Creates a new Response from a slice of utf8 encoded bytes, useful when building client code.
pub fn get_phrase(status: u16) -> &'a str
[src]
Get the phrase related to the http status code from a big,lazy initialized,HashMap based on the official codes documented in wikipedia.
pub fn as_bytes(&self) -> &'a [u8]
[src]
Trait Implementations
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,
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
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>,