Struct NoContent

pub 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)
}

Trait Implementations

impl Clone for NoContent

fn clone(&self) -> NoContent

impl Copy for NoContent

impl Debug for NoContent

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

impl IntoResponse for NoContent

fn into_response(self) -> Response

Auto Trait Implementations

impl Freeze for NoContent

impl RefUnwindSafe for NoContent

impl Send for NoContent

impl Sync for NoContent

impl Unpin for NoContent

impl UnsafeUnpin for NoContent

impl UnwindSafe for NoContent

Blanket Implementations

impl<H, T> HandlerWithoutStateExt<T> for NoContent where H: Handler<T, ()>,

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for NoContent where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for NoContent where ST: ?Sized, DT: ?Sized,

impl<T> Any for NoContent where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for NoContent where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for NoContent where T: ?Sized,

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

impl<T> CloneToUninit for NoContent where T: Clone,

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

impl<T> From<T> for NoContent

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FromRef<T> for NoContent where T: Clone,

fn from_ref(input: &T) -> T

impl<T> Instrument for NoContent

impl<T> Read<Exclusive, BecauseExclusive> for NoContent where T: ?Sized,

impl<T> Same for NoContent

type Output = T;

impl<T> ToOwned for NoContent where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> WithSubscriber for NoContent

impl<T, U> Into<U> for NoContent where U: From<T>,

fn into(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<U> for NoContent where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for NoContent where U: TryFrom<T>,

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

impl<V, T> VZip<V> for NoContent where V: MultiLane<T>,

fn vzip(self) -> V