pub trait IHttpResponse: Send {
// Required methods
fn status(&self) -> u16;
fn set_status(&mut self, code: u16);
fn set_header(&mut self, key: &str, value: &str);
fn write_bytes<'life0, 'async_trait>(
&'life0 mut self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn has_body(&self) -> bool { ... }
fn write_text<'life0, 'life1, 'async_trait>(
&'life0 mut self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
HTTP response abstraction.
Analogous to ASP.NET Core’s HttpResponse.
Methods are non-generic to maintain dyn-compatibility.
Required Methods§
fn set_status(&mut self, code: u16)
fn set_header(&mut self, key: &str, value: &str)
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".