Struct salvo::Response[][src]

pub struct Response { /* fields omitted */ }
Expand description

Represents an HTTP response

Implementations

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
[src]

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, 
[src]

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

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

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

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]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Default for Response[src]

pub fn default() -> Response[src]

Returns the “default value” for a type. Read more

impl Display for Response[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V