[−][src]Struct milstian_internet_framework::application_layer::http::response::Message
Fields
protocol: String
status: String
headers: HashMap<String, String, RandomState>
body: Vec<u8>
Methods
impl Message
[src]
pub fn new(
protocol: String,
status: String,
headers: HashMap<String, String, RandomState>,
body: Vec<u8>
) -> Message
[src]
protocol: String,
status: String,
headers: HashMap<String, String, RandomState>,
body: Vec<u8>
) -> Message
pub fn header_to_string(&self) -> String
[src]
Get the HTTP header as a new string
use milstian_http::response::Message; use std::collections::HashMap; assert_eq!( Message::new( "HTTP/1.0".to_string(), "200 OK".to_string(), HashMap::new(), b"<html><body>Nothing here</body></html>".to_vec() ).header_to_string(), "HTTP/1.0 200 OK\r\n\r\n".to_string() );
pub fn to_string(&mut self) -> String
[src]
Convert response message into a string
use milstian_http::response::Message; use std::collections::HashMap; assert_eq!( Message::new( "HTTP/1.0".to_string(), "200 OK".to_string(), HashMap::new(), b"<html><body>Nothing here</body></html>".to_vec() ).to_string(), "HTTP/1.0 200 OK\r\n\r\n<html><body>Nothing here</body></html>".to_string() );
pub fn to_bytes(&mut self) -> Vec<u8>
[src]
Convert message into bytes
use milstian_http::response::Message; use std::collections::HashMap; assert_eq!( Message::new( "HTTP/1.0".to_string(), "200 OK".to_string(), HashMap::new(), b"<html><body>Nothing here</body></html>".to_vec() ).to_bytes(), b"HTTP/1.0 200 OK\r\n\r\n<html><body>Nothing here</body></html>".to_vec() );
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,