Skip to main content

IntoResponse

Trait IntoResponse 

Source
pub trait IntoResponse {
    // Required method
    fn into_response(self) -> Result<Response, ErrorCode>;
}
Available on crate feature http only.
Expand description

A trait for any type that can be converted into a wasip3::http::types::Response.

This trait provides a unified interface for adapting user-defined response types into the lower-level wasip3::http::types::Response format used by the WASI HTTP subsystem.

Implementing IntoResponse enables ergonomic conversion from domain-level response types or builders into standardized WASI HTTP responses.

§See also

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoResponse for &'static str

Source§

impl IntoResponse for &[u8]

Source§

impl IntoResponse for ()

Source§

impl IntoResponse for Bytes

Source§

impl IntoResponse for Response

Source§

impl IntoResponse for String

Source§

impl IntoResponse for Vec<u8>

Source§

impl<T: Serialize> IntoResponse for (StatusCode, Json<T>)

Source§

impl<T> IntoResponse for (StatusCode, HeaderMap, T)
where T: Body + Any, T::Data: Into<Vec<u8>>, T::Error: Into<Box<dyn Error + Send + Sync + 'static>>,

Source§

impl<T> IntoResponse for (StatusCode, T)
where T: Body + Any, T::Data: Into<Vec<u8>>, T::Error: Into<Box<dyn Error + Send + Sync + 'static>>,

Source§

impl<T> IntoResponse for Response<T>
where T: Body + Any, T::Data: Into<Vec<u8>>, T::Error: Into<Box<dyn Error + Send + Sync + 'static>>,

Implementors§