1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

re-export ServiceFactory (#2325)

This commit is contained in:
Rob Ede
2021-07-12 16:55:41 +01:00
committed by GitHub
parent 5a14ffeef2
commit 293c52c3ef
7 changed files with 31 additions and 33 deletions

View File

@@ -24,20 +24,14 @@ use {
use crate::{error::Error, HttpResponseBuilder};
/// An HTTP Response
/// An outgoing response.
pub struct HttpResponse<B = AnyBody> {
res: Response<B>,
pub(crate) error: Option<Error>,
}
impl HttpResponse<AnyBody> {
/// Create HTTP response builder with specific status.
#[inline]
pub fn build(status: StatusCode) -> HttpResponseBuilder {
HttpResponseBuilder::new(status)
}
/// Create a response.
/// Constructs a response.
#[inline]
pub fn new(status: StatusCode) -> Self {
Self {
@@ -46,6 +40,12 @@ impl HttpResponse<AnyBody> {
}
}
/// Constructs a response builder with specific HTTP status.
#[inline]
pub fn build(status: StatusCode) -> HttpResponseBuilder {
HttpResponseBuilder::new(status)
}
/// Create an error response.
#[inline]
pub fn from_error(error: impl Into<Error>) -> Self {