Struct poem::ResponseBuilder
source · [−]pub struct ResponseBuilder { /* private fields */ }
Expand description
An response builder.
Implementations
sourceimpl ResponseBuilder
impl ResponseBuilder
sourcepub fn status(self, status: StatusCode) -> Self
pub fn status(self, status: StatusCode) -> Self
Sets the HTTP status for this response.
By default this is StatusCode::OK
.
sourcepub fn version(self, version: Version) -> Self
pub fn version(self, version: Version) -> Self
Sets the HTTP version for this response.
By default this is Version::HTTP_11
sourcepub fn header<K, V>(self, key: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
Appends a header to this response builder.
sourcepub fn typed_header<T: Header>(self, header: T) -> Self
pub fn typed_header<T: Header>(self, header: T) -> Self
Inserts a typed header to this response.
sourcepub fn content_type(self, content_type: impl AsRef<str>) -> Self
pub fn content_type(self, content_type: impl AsRef<str>) -> Self
Sets the Content-Type
header on the response.
sourcepub fn extension<T>(self, extension: T) -> Selfwhere
T: Any + Send + Sync + 'static,
pub fn extension<T>(self, extension: T) -> Selfwhere
T: Any + Send + Sync + 'static,
Adds an extension to this response.
Auto Trait Implementations
impl !RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl !UnwindSafe for ResponseBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more