pub struct ResponseBuilder { /* private fields */ }Implementations§
Source§impl ResponseBuilder
impl ResponseBuilder
Sourcepub fn status(self, status: StatusCode) -> Self
pub fn status(self, status: StatusCode) -> Self
Sets the response status code.
Sourcepub fn ascii_metadata(
self,
key: impl TryInto<HeaderName, Error: Into<Error>>,
val: impl Into<String>,
) -> Result<Self, Error>
pub fn ascii_metadata( self, key: impl TryInto<HeaderName, Error: Into<Error>>, val: impl Into<String>, ) -> Result<Self, Error>
Appends ASCII metadata to the response.
Sourcepub fn binary_metadata(
self,
key: impl TryInto<HeaderName, Error: Into<Error>>,
val: impl AsRef<[u8]>,
) -> Result<Self, Error>
pub fn binary_metadata( self, key: impl TryInto<HeaderName, Error: Into<Error>>, val: impl AsRef<[u8]>, ) -> Result<Self, Error>
Appends binary metadata to the response.
Sourcepub fn message_codec(
self,
message_codec: impl Into<String>,
) -> Result<Self, Error>
pub fn message_codec( self, message_codec: impl Into<String>, ) -> Result<Self, Error>
Sets the message codec for this response.
Typical codecs are ‘json’ and ‘proto’, corresponding to the
content-types application/json and application/proto.
The caller is responsible for making sure the response payload matches this message codec.
Sourcepub fn content_encoding(
self,
content_encoding: impl Into<String>,
) -> Result<Self, Error>
pub fn content_encoding( self, content_encoding: impl Into<String>, ) -> Result<Self, Error>
Sets the response content encoding (e.g. compression).
Sourcepub fn unary<T>(self, body: T) -> Result<UnaryResponse<T>, Error>
pub fn unary<T>(self, body: T) -> Result<UnaryResponse<T>, Error>
Builds a UnaryResponse.
Sourcepub fn streaming<T>(self, body: T) -> Result<StreamingResponse<T>, Error>
pub fn streaming<T>(self, body: T) -> Result<StreamingResponse<T>, Error>
Builds a StreamingResponse.
Trait Implementations§
Source§impl Debug for ResponseBuilder
impl Debug for ResponseBuilder
Source§impl Default for ResponseBuilder
impl Default for ResponseBuilder
Source§fn default() -> ResponseBuilder
fn default() -> ResponseBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ResponseBuilder
impl RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnwindSafe for ResponseBuilder
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