Struct NoContent

struct NoContent

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...
# drop(user);
    Ok(NoContent)
}

Implementations

impl Clone for NoContent

fn clone(self: &Self) -> NoContent

impl Copy for NoContent

impl Debug for NoContent

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl Freeze for NoContent

impl IntoResponse for NoContent

fn into_response(self: Self) -> Response

impl RefUnwindSafe for NoContent

impl Send for NoContent

impl Sync for NoContent

impl Unpin for NoContent

impl UnwindSafe for NoContent

impl<H, T> HandlerWithoutStateExt for NoContent

fn into_service(self: Self) -> HandlerService<H, T, ()>
fn into_make_service(self: Self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service_with_connect_info<C>(self: Self) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>

impl<T> Any for NoContent

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for NoContent

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for NoContent

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for NoContent

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for NoContent

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FromRef for NoContent

fn from_ref(input: &T) -> T

impl<T> Instrument for NoContent

impl<T> Same for NoContent

impl<T> ToOwned for NoContent

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> WithSubscriber for NoContent

impl<T, U> Into for NoContent

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for NoContent

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for NoContent

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<V, T> VZip for NoContent

fn vzip(self: Self) -> V