pub struct Response {
pub status: u16,
pub headers: Vec<(String, String)>,
pub body: Body,
}Expand description
An HTTP response.
Fields§
§status: u16§headers: Vec<(String, String)>§body: BodyImplementations§
Source§impl Response
impl Response
pub fn new(status: u16) -> Response
pub fn with_header(self, name: &str, value: &str) -> Response
pub fn with_body(self, body: impl Into<Vec<u8>>) -> Response
Sourcepub fn with_stream(
self,
producer: impl FnOnce(&mut dyn Write) -> Result<()> + Send + 'static,
) -> Response
pub fn with_stream( self, producer: impl FnOnce(&mut dyn Write) -> Result<()> + Send + 'static, ) -> Response
Stream the body: producer is given the raw writer and flushes chunks
as they become available. Prefer the higher-level StreamSink /
SseSink wrappers (see sutegi-web’s stream() / sse()).
Auto Trait Implementations§
impl !RefUnwindSafe for Response
impl !Sync for Response
impl !UnwindSafe for Response
impl Freeze for Response
impl Send for Response
impl Unpin for Response
impl UnsafeUnpin for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more