Struct salvo::Response[][src]

pub struct Response { /* fields omitted */ }

Represents an HTTP response


impl Response[src]

pub fn new() -> Response[src]

Creates a new blank Response.

pub fn from_hyper(req: Response<Body>) -> Response[src]

Create a request from an hyper::Request.

This constructor consumes the hyper::Request.

pub fn headers(&self) -> &HeaderMap<HeaderValue>[src]

pub fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>[src]

pub fn set_headers(&mut self, headers: HeaderMap<HeaderValue>)[src]

pub fn version(&self) -> Version[src]

pub fn version_mut(&mut self) -> &mut Version[src]

pub fn body(&self) -> Option<&Body>[src]

pub fn body_mut(&mut self) -> Option<&mut Body>[src]

pub fn set_body(&mut self, body: Option<Body>)[src]

pub fn take_body(&mut self) -> Option<Body>[src]

pub fn cookies(&self) -> &CookieJar[src]

pub fn header_cookies(&self) -> Vec<Cookie<'_>, Global>[src]

pub fn status_code(&mut self) -> Option<StatusCode>[src]

pub fn set_status_code(&mut self, code: StatusCode)[src]

pub fn set_http_error(&mut self, err: HttpError)[src]

pub fn render_json<T>(&mut self, data: &T) where
    T: Serialize

pub fn render_json_text(&mut self, data: &str)[src]

pub fn render_html_text(&mut self, data: &str)[src]

pub fn render_plain_text(&mut self, data: &str)[src]

pub fn render_xml_text(&mut self, data: &str)[src]

pub fn render_binary(&mut self, content_type: HeaderValue, data: &[u8])[src]

pub fn write_body_bytes(&mut self, data: &[u8])[src]

pub fn streaming<S, O, E>(&mut self, stream: S) where
    E: Into<Box<dyn Error + 'static + Sync + Send, Global>> + 'static,
    S: Stream<Item = Result<O, E>> + Send + 'static,
    O: Into<Bytes> + 'static, 

pub fn redirect_temporary<U>(&mut self, url: U) where
    U: AsRef<str>, 

pub fn redirect_found<U>(&mut self, url: U) where
    U: AsRef<str>, 

pub fn redirect_other<U>(&mut self, url: U) -> Result<(), InvalidHeaderValue> where
    U: AsRef<str>, 

pub fn commit(&mut self)[src]

Salvo executes before handler and path handler in sequence, when the response is in a committed state, subsequent handlers will not be executed, and then all after handlers will be executed.

This is a sign that the http request is completed, which can be used to process early return verification logic, such as permission verification, etc.

pub fn is_commited(&self) -> bool[src]

Trait Implementations

impl Debug for Response[src]

impl Default for Response[src]

impl Display 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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToString for T where
    T: Display + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,