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§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 moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes