pub struct Response { /* private fields */ }Implementations§
Source§impl Response
impl Response
pub fn new(status: StatusCode) -> Self
pub fn ok() -> Self
pub fn text(body: &str) -> Self
pub fn text_with_status(status: StatusCode, body: &str) -> Self
pub fn json<T: Serialize>(value: &T) -> Result<Self, Error>
pub fn json_with_status<T: Serialize>( status: StatusCode, value: &T, ) -> Result<Self, Error>
pub fn insert_header( &mut self, name: HeaderName, value: HeaderValue, ) -> &mut Self
pub fn append_wire_header( &mut self, name: &'static str, value: &str, ) -> &mut Self
pub fn append_wire_header_static( &mut self, name: &'static str, value: &'static str, ) -> &mut Self
pub fn content_type(&mut self, value: &'static str) -> &mut Self
pub fn not_found() -> Self
pub fn status(&self) -> StatusCode
pub fn set_status(&mut self, status: StatusCode)
pub fn headers(&self) -> &HeaderList
pub fn headers_mut(&mut self) -> &mut HeaderList
pub fn wire_headers(&self) -> &[u8] ⓘ
pub fn has_wire_headers(&self) -> bool
pub fn body(&self) -> &[u8] ⓘ
pub fn body_mut(&mut self) -> &mut Owned
pub fn into_body(self) -> Owned
pub fn into_body_bytes(self) -> Shared
pub fn set_body<B>(&mut self, body: B)where
B: IntoBody<'static>,
pub fn set_body_str(&mut self, body: &str) -> &mut Self
pub fn body_str(&self) -> Option<&str>
pub fn push_chunk(&mut self, data: impl Into<Shared>)
pub fn chunked_parts(&self) -> Option<&[Shared]>
pub fn is_chunked(&self) -> bool
Trait Implementations§
Source§impl From<FixedResponseInner<'static>> for Response
impl From<FixedResponseInner<'static>> for Response
Source§fn from(response: FixedResponseInner<'static>) -> Self
fn from(response: FixedResponseInner<'static>) -> Self
Converts to this type from the input type.
Source§impl From<MonoResponseInner<'static>> for Response
impl From<MonoResponseInner<'static>> for Response
Source§fn from(response: MonoResponseInner<'static>) -> Self
fn from(response: MonoResponseInner<'static>) -> Self
Converts to this type from the input type.
Source§impl From<Response> for ServeInner<'static>
impl From<Response> for ServeInner<'static>
Source§impl IntoServeResponse<'static> for Response
impl IntoServeResponse<'static> for Response
fn into_serve_response(self) -> ServeInner<'static>
Auto Trait Implementations§
impl !RefUnwindSafe for Response
impl !Send for Response
impl !Sync for Response
impl !UnwindSafe for Response
impl Freeze 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