pub struct WithStatus<T, const CODE: u16>(pub T);Expand description
Generic wrapper for returning a response with a custom status code.
The status code is specified as a const generic parameter.
§Example
ⓘ
use rustapi_core::response::WithStatus;
async fn accepted_handler() -> WithStatus<String, 202> {
WithStatus("Request accepted for processing".to_string())
}
async fn custom_status() -> WithStatus<&'static str, 418> {
WithStatus("I'm a teapot")
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone, const CODE: u16> Clone for WithStatus<T, CODE>
impl<T: Clone, const CODE: u16> Clone for WithStatus<T, CODE>
Source§fn clone(&self) -> WithStatus<T, CODE>
fn clone(&self) -> WithStatus<T, CODE>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: IntoResponse, const CODE: u16> IntoResponse for WithStatus<T, CODE>
impl<T: IntoResponse, const CODE: u16> IntoResponse for WithStatus<T, CODE>
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert self into a Response
Source§impl<T: for<'a> Schema<'a>, const CODE: u16> ResponseModifier for WithStatus<T, CODE>
impl<T: for<'a> Schema<'a>, const CODE: u16> ResponseModifier for WithStatus<T, CODE>
Source§fn update_response(op: &mut Operation)
fn update_response(op: &mut Operation)
Update the operation with response information
Auto Trait Implementations§
impl<T, const CODE: u16> Freeze for WithStatus<T, CODE>where
T: Freeze,
impl<T, const CODE: u16> RefUnwindSafe for WithStatus<T, CODE>where
T: RefUnwindSafe,
impl<T, const CODE: u16> Send for WithStatus<T, CODE>where
T: Send,
impl<T, const CODE: u16> Sync for WithStatus<T, CODE>where
T: Sync,
impl<T, const CODE: u16> Unpin for WithStatus<T, CODE>where
T: Unpin,
impl<T, const CODE: u16> UnwindSafe for WithStatus<T, CODE>where
T: 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