pub struct Response {
pub status: u16,
pub headers: Headers,
pub body: Body,
}Fields§
§status: u16§headers: Headers§body: BodyImplementations§
Source§impl Response
impl Response
pub fn new(status: u16) -> Response
pub fn bytes(status: u16, content_type: &str, body: Vec<u8>) -> Response
pub fn text(status: u16, s: &str) -> Response
pub fn json(status: u16, v: &Value) -> Response
pub fn header(self, name: &str, value: &str) -> Response
Sourcepub fn body_bytes(&self) -> &[u8] ⓘ
pub fn body_bytes(&self) -> &[u8] ⓘ
the body bytes (client side: always Bytes)
pub fn body_json(&self, limits: Limits) -> Option<Value>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Response
impl !Sync for Response
impl !UnwindSafe for Response
impl Forget for Response
impl Freeze for Responsewhere
*const u8 is !null: Freeze,
PhantomData<(String, String)>: Freeze,
PhantomData<u8>: Freeze,
*const dyn FnMut(&mut Vec<u8>) -> bool + Send is !null: Freeze,
PhantomData<dyn FnMut(&mut Vec<u8>) -> bool + Send>: Freeze,
*const dyn FnOnce(Upgraded) + Send is !null: Freeze,
PhantomData<dyn FnOnce(Upgraded) + Send>: Freeze,
impl Move for Response
impl Send for Response
impl Unpin for Response
impl UnsafeUnpin for Responsewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const dyn FnMut(&mut Vec<u8>) -> bool + Send is !null: UnsafeUnpin,
PhantomData<dyn FnMut(&mut Vec<u8>) -> bool + Send>: UnsafeUnpin,
*const dyn FnOnce(Upgraded) + Send is !null: UnsafeUnpin,
PhantomData<dyn FnOnce(Upgraded) + Send>: UnsafeUnpin,
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