Type Alias SyncResponseBuilder

Source
pub type SyncResponseBuilder = ResponseBuilder<SyncResponseBody>;
Expand description

阻塞 HTTP 响应构建器

Aliased Type§

pub struct SyncResponseBuilder { /* private fields */ }

Implementations

Source§

impl<B> ResponseBuilder<B>

Source

pub fn status_code(&mut self, status_code: StatusCode) -> &mut Self

设置 HTTP 状态码

Source

pub fn headers(&mut self, headers: HeaderMap) -> &mut Self

设置 HTTP Headers

Source

pub fn version(&mut self, version: Version) -> &mut Self

设置 HTTP 版本

Source

pub fn server_ip(&mut self, server_ip: IpAddr) -> &mut Self

设置 HTTP 服务器 IP 地址

Source

pub fn server_port(&mut self, server_port: NonZeroU16) -> &mut Self

设置 HTTP 服务器端口号

Source

pub fn extensions(&mut self, extensions: Extensions) -> &mut Self

设置扩展信息

Source

pub fn header( &mut self, header_name: impl IntoHeaderName, header_value: impl Into<HeaderValue>, ) -> &mut Self

添加 HTTP Header

Source

pub fn body(&mut self, body: B) -> &mut Self

添加 HTTP 响应体

Source

pub fn metrics(&mut self, metrics: Metrics) -> &mut Self

设置 HTTP 响应的指标信息

Source§

impl<B: Default> ResponseBuilder<B>

Source

pub fn build(&mut self) -> Response<B>

构建 HTTP 请求

Trait Implementations

Source§

impl<B: Debug> Debug for ResponseBuilder<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Default> Default for ResponseBuilder<B>

Source§

fn default() -> ResponseBuilder<B>

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