pub struct Response<B: Body = ResBody> { /* private fields */ }Expand description
响应体
use silent::Response;
let req = Response::empty();Implementations§
source§impl<B: Body> Response<B>
impl<B: Body> Response<B>
sourcepub fn set_status(&mut self, status: StatusCode)
pub fn set_status(&mut self, status: StatusCode)
设置响应状态
sourcepub fn with_status(self, status: StatusCode) -> Self
pub fn with_status(self, status: StatusCode) -> Self
包含响应状态
sourcepub fn set_header(&mut self, key: HeaderName, value: HeaderValue)
pub fn set_header(&mut self, key: HeaderName, value: HeaderValue)
设置响应header
sourcepub fn with_header(self, key: HeaderName, value: HeaderValue) -> Self
pub fn with_header(self, key: HeaderName, value: HeaderValue) -> Self
包含响应header
sourcepub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
获取extensions
sourcepub fn extensions_mut(&mut self) -> &mut Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
获取extensions_mut
sourcepub fn get_config_uncheck<T: Send + Sync + 'static>(&self) -> &T
pub fn get_config_uncheck<T: Send + Sync + 'static>(&self) -> &T
获取配置(Uncheck)
sourcepub fn configs_mut(&mut self) -> &mut Configs
pub fn configs_mut(&mut self) -> &mut Configs
获取可变全局配置
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
设置响应header
sourcepub fn content_length(&self) -> SizeHint
pub fn content_length(&self) -> SizeHint
获取响应体长度
sourcepub fn set_typed_header<H>(&mut self, header: H)where
H: Header,
pub fn set_typed_header<H>(&mut self, header: H)where
H: Header,
设置响应header
sourcepub fn with_typed_header<H>(self, header: H) -> Selfwhere
H: Header,
pub fn with_typed_header<H>(self, header: H) -> Selfwhere
H: Header,
包含响应header
sourcepub fn copy_from_response(&mut self, res: Response<B>)
pub fn copy_from_response(&mut self, res: Response<B>)
move response to from another response
Trait Implementations§
source§impl From<SilentError> for Response
impl From<SilentError> for Response
source§fn from(value: SilentError) -> Self
fn from(value: SilentError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<B> Freeze for Response<B>where
B: Freeze,
impl<B = ResBody> !RefUnwindSafe for Response<B>
impl<B> Send for Response<B>where
B: Send,
impl<B> Sync for Response<B>where
B: Sync,
impl<B> Unpin for Response<B>where
B: Unpin,
impl<B = ResBody> !UnwindSafe for Response<B>
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