[−][src]Struct wascc_codec::http::Response
Represents an HTTP response that the guest module would like to return in response to a request command
Fields
status_code: u32status: Stringheader: HashMap<String, String>body: Vec<u8>Methods
impl Response[src]
pub fn json<T>(payload: T, status_code: u32, status: &str) -> Response where
T: Serialize, [src]
T: Serialize,
Creates a response with a given status code and serializes the given payload as JSON
pub fn not_found() -> Response[src]
Handy shortcut for creating a 404/Not Found response
pub fn ok() -> Response[src]
Useful shortcut for creating a 200/OK response
pub fn internal_server_error(msg: &str) -> Response[src]
Useful shortcut for creating a 500/Internal Server Error response
pub fn bad_request() -> Response[src]
Shortcut for creating a 400/Bad Request response
Trait Implementations
impl Debug for Response[src]
impl Default for Response[src]
impl<'de> Deserialize<'de> for Response[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl PartialEq<Response> for Response[src]
impl Serialize for Response[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralPartialEq for Response[src]
Auto Trait Implementations
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
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.
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>,