pub struct NoContent;
Expand description
An empty response with 204 No Content status.
Due to historical and implementation reasons, the IntoResponse
implementation of ()
(unit type) returns an empty response with 200 StatusCode::OK
status.
If you specifically want a 204 StatusCode::NO_CONTENT
status, you can use either StatusCode
type
directly, or this shortcut struct for self-documentation.
use axum::{extract::Path, response::NoContent};
async fn delete_user(Path(user): Path<String>) -> Result<NoContent, String> {
// ...access database...
Ok(NoContent)
}
Trait Implementations§
source§impl IntoResponse for NoContent
impl IntoResponse for NoContent
source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
impl Copy for NoContent
Auto Trait Implementations§
impl Freeze for NoContent
impl RefUnwindSafe for NoContent
impl Send for NoContent
impl Sync for NoContent
impl Unpin for NoContent
impl UnwindSafe for NoContent
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service
and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read moresource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService
which stores information
about the incoming connection and has no state. Read more