Struct salvo_core::http::response::Response [−][src]
pub struct Response { /* fields omitted */ }
Represents an HTTP response
Implementations
impl Response
[src]
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
[src]
pub fn headers_mut(&mut self) -> &mut HeaderMap
[src]
pub fn set_headers(&mut self, headers: HeaderMap)
[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<'_>>
[src]
pub fn get_cookie<T>(&self, name: T) -> Option<&Cookie<'static>> where
T: AsRef<str>,
[src]
T: AsRef<str>,
pub fn add_cookie(&mut self, cookie: Cookie<'static>)
[src]
pub fn remove_cookie<T>(&mut self, name: T) where
T: Into<Cow<'static, str>>,
[src]
T: Into<Cow<'static, str>>,
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: Serialize>(&mut self, data: &T)
[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
S: Stream<Item = Result<O, E>> + Send + 'static,
O: Into<Bytes> + 'static,
E: Into<Box<dyn StdError + Send + Sync>> + 'static,
[src]
S: Stream<Item = Result<O, E>> + Send + 'static,
O: Into<Bytes> + 'static,
E: Into<Box<dyn StdError + Send + Sync>> + 'static,
pub fn redirect_temporary<U: AsRef<str>>(&mut self, url: U)
[src]
pub fn redirect_found<U: AsRef<str>>(&mut self, url: U)
[src]
pub fn redirect_other<U: AsRef<str>>(
&mut self,
url: U
) -> Result<(), InvalidHeaderValue>
[src]
&mut self,
url: U
) -> Result<(), InvalidHeaderValue>
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
Auto Trait Implementations
impl !RefUnwindSafe for Response
impl !RefUnwindSafe for Response
impl !UnwindSafe for Response
impl !UnwindSafe for Response
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,