Struct tower_http::set_status::SetStatus
source · pub struct SetStatus<S> { /* private fields */ }
Expand description
Middleware to override status codes.
See the module docs for more details.
Implementations§
source§impl<S> SetStatus<S>
impl<S> SetStatus<S>
sourcepub fn new(inner: S, status: StatusCode) -> Self
pub fn new(inner: S, status: StatusCode) -> Self
Create a new SetStatus
.
The response status code will be status
regardless of what the inner service returns.
sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
sourcepub fn layer(status: StatusCode) -> SetStatusLayer
pub fn layer(status: StatusCode) -> SetStatusLayer
Returns a new Layer
that wraps services with a SetStatus
middleware.
Trait Implementations§
source§impl<S, ReqBody, ResBody> Service<Request<ReqBody>> for SetStatus<S>
impl<S, ReqBody, ResBody> Service<Request<ReqBody>> for SetStatus<S>
impl<S: Copy> Copy for SetStatus<S>
Auto Trait Implementations§
impl<S> Freeze for SetStatus<S>where
S: Freeze,
impl<S> RefUnwindSafe for SetStatus<S>where
S: RefUnwindSafe,
impl<S> Send for SetStatus<S>where
S: Send,
impl<S> Sync for SetStatus<S>where
S: Sync,
impl<S> Unpin for SetStatus<S>where
S: Unpin,
impl<S> UnwindSafe for SetStatus<S>where
S: UnwindSafe,
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