Struct gotham_restful::Success
source · pub struct Success<T> { /* private fields */ }
Expand description
This can be returned from a resource when there is no cause of an error.
Usage example:
#[derive(Deserialize, Serialize)]
struct MyResponse {
message: &'static str
}
#[read_all]
fn read_all() -> Success<MyResponse> {
let res = MyResponse {
message: "I'm always happy"
};
res.into()
}
Implementations§
source§impl<T> Success<T>
impl<T> Success<T>
sourcepub fn header<K: IntoHeaderName>(&mut self, name: K, value: HeaderValue)
pub fn header<K: IntoHeaderName>(&mut self, name: K, value: HeaderValue)
Set a custom HTTP header. If a header with this name was set before, its value is being updated.
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Allow manipulating HTTP headers.
Trait Implementations§
source§impl<T: ResponseBody> IntoResponse for Success<T>
impl<T: ResponseBody> IntoResponse for Success<T>
source§impl<T: ResponseBody> ResponseSchema for Success<T>
impl<T: ResponseBody> ResponseSchema for Success<T>
source§fn schema(code: StatusCode) -> OpenapiSchema
fn schema(code: StatusCode) -> OpenapiSchema
Return the schema of the response for the given status code. The code may
only be one that was previously returned by Self::status_codes. The
implementation should panic if that is not the case.
source§fn status_codes() -> Vec<StatusCode>
fn status_codes() -> Vec<StatusCode>
All status codes returned by this response. Returns
[StatusCode::OK]
by default.Auto Trait Implementations§
impl<T> RefUnwindSafe for Success<T>where
T: RefUnwindSafe,
impl<T> Send for Success<T>where
T: Send,
impl<T> Sync for Success<T>where
T: Sync,
impl<T> Unpin for Success<T>where
T: Unpin,
impl<T> UnwindSafe for Success<T>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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more